Javascript collection
问题 sorry for noobie question. Can you explain please, what is the difference between: 1. var a = []; a['b'] = 1; 2. var a = {}; a['b'] = 1; I could not find article in the internet so wrote here. 回答1: Literals The [] and {} are called the array and object literals respectively. var x = [] is short for var x = new Array(); and var y = {} is short for var y = new Object(); Arrays Arrays are structures with a length property. You can access values via their numeric index. var x = [] or var x = new