What is this called with objects?

if you have an array eg let a = [1,2,3,4,5]

then i console.log( {a}) // {a: [1,2,3,4,5]}

what kind of object declaration is this?

this is an object literal shorthand

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#new_notations_in_ecmascript_2015

1 Like