Given an array:
const array = [{a:1}]
Is there a one liner to extract the value of a
using destructuring
?
I tried something like this which doesn't work:
const [{a} = array]
You could unpack array and then first object inside it to get a
.
const array = [{a:1}]
const [{a}] = array;
console.log(a)