The first and third are equivalent and create a new array. The second creates a new empty object, not an array.
var myArray = []; //create a new array
var myArray = {}; //creates **a new empty object**
var myArray = new Array(); //create a new array
More Related Contents:
- Sorting array of object based on range of Numbers of String [closed]
- Sort array of objects by string property value
- How to determine if Javascript array contains an object with an attribute that equals a given value?
- How to remove item from array by value? [duplicate]
- Javascript call() & apply() vs bind()?
- How to convert an Object {} to an Array [] of key-value pairs in JavaScript
- How to detect if a variable is an array
- How to count the number of occurrences of each item in an array? [duplicate]
- JavaScript Loops: for…in vs for
- What is the most efficient way to reverse an array in Javascript?
- How can I find matching values in two arrays? [duplicate]
- Sort an array with arrays in it by string
- Unpacking array into separate variables in JavaScript
- How can I reverse an array in JavaScript without using libraries?
- Remove all falsy values from an array
- Using promise function inside Javascript Array map
- What does $(selector)[0] mean in jQuery?
- Change the value of an array changes original array JavaScript
- What is the difference between a shallow copy and a deep copy with JavaScript arrays? [duplicate]
- Splicing a Javascript array from within the callback passed to forEach
- javascript: convert two dimensional array to array of objects using the first ‘row’ to define properties
- Array.size() vs Array.length
- Create array of all integers between two numbers, inclusive, in Javascript/jQuery
- Adding text to beginning of each array element
- Handling multiple files from an input element in an array with Google Apps Script
- How to convert an array into an object in javascript with mapped key-value pairs?
- How are JavaScript arrays implemented?
- Compare two Arrays with Objects and create new array with unmatched objects
- Difference between ( for… in ) and ( for… of ) statements?
- Find object having maximum value for the `id` property in an array of objects