1👍
It’s called array destructuring.
In your case const [, name] = key.match(/\/(.+)\.md$/);
is the same as const name = key.match(/\/(.+)\.md$/)[1]
- [Vuejs]-Prevent Vue Multiple Select to Store an Empty Array
- [Vuejs]-How to update a child component when incrementing it in the parent component?
0👍
It means take the second value from the array returned by key.match
and assign it to the variable name
const [a, b] = [123, 456];
console.log('a:', a, 'b:', b); // a = 123, b = 456
const [, d] = [111, 222];
console.log('d:', d); // d = 222
👤gman
- [Vuejs]-Can't access data. object in another object?
- [Vuejs]-(VueJS) Update component whenever displayed
Source:stackexchange.com