I know this is a more than easy question and many similar ones exist here, but I couldn't find a quick solution.
So I just want to create a variable called age2 that holds the value of Mikes age, so 29.
let arr = [
{
"name": "Mike",
"age": 29
},
{
"name": "Michael",
"age": 24
}
]
I thought this should work:
let [first: {age: age2}] = arr
To first get the first element and then destructure the object, but it says:
Uncaught SyntaxError: missing ] after element list