I know that we can add properties to an already defined array like this,
var array1 = [1, 2, 3];
array1.prop1 = 'first';
console.log(array1); // [ 1, 2, 3, prop1: 'first' ]
My question is that is there any syntax for doing the same thing while declaring the array? Something similar to this,
var array1 = [1, 2, 3, prop1: 'first'] // SyntaxError: Unexpected token :
P.S. Some may say adding properties to arrays is not considered a good practice. That is actually not the answer I'm looking for. I'm just asking about the possibility of doing something like this.