JavaScript arrays braces vs brackets -


what difference between each of following array definitions.

var myarray = []; var myarray = {}; var myarray = new array(); 

the first , third equivalent , create new array. second creates new empty object, not array.

var myarray = []; //create new array var myarray = {}; //creates **a new empty object** var myarray = new array(); //create new array 

Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -