What’s the difference between “{}” and “[]” while declaring a JavaScript array? Normally I declare like
var a = [];
What is the meaning of declaring the array as var a = {}
Some of the meaning and explanation between [] and {} are;
var a = {};
is an object-key-value pairs. var a = [];
is an array-values stored in sequential indexes. We are not creating array when we are using {}
, we are creating object
For more info, continue reading on Stack Overflow
Add to favorites