Take elements by key in objects array

Let’s say I have got an array of objects like this:

const a = [
 0: {name: 'John', lastName: 'Smith'}
 1: {name: 'Juan', lastName: 'Perez'}
 myKey: true
 myKey2: false
]

How can I extract from my array just the value of ‘myKey’? So the expected output would be

const myKeyValue = true

Answer

If you want a single value and you know the key, use:

const myKeyValue = a.myKey