Reputation: 49
What's the difference between var = [] and var = {} in JavaScript?
Upvotes: 1
Views: 3607
Reputation: 11
[] : The square brackets are for Arrays. {} : The curly brackets are for Objects.
Upvotes: 1
Reputation: 1
Here you can find some info about your doubts: https://www.w3schools.com/js/js_datatypes.asp
Upvotes: 0
Reputation: 10127
[]
is an empty array (i.e. with zero items).
{}
is an empty object (i.e. with zero key-value pairs).
Upvotes: 6