A fool's understanding, the object is wrapped in curly braces {} Things, the object has a key/value Key/value
In short, the JS object as long as it does not conform to the JS variable naming rules need to add quotation marks, both at the time of definition and reference, and the object can not be used as an array to use subscript access, can only use the Key Name key (property name) access
var obj = {' 1 ': 3, ' @**^%* ': ' I am the symbol oh ', 3:4, ' Tom Ni Hao ': 2}; Console.log (obj[1])//3, although there is no error in the new version of Chrome here, but because it does not conform to the JS variable name rules, so it is best to add a quotation mark, so Console.log (obj[' 1 ']) console.log (obj[' @**^%* ');//I am the symbol Oh console.log (obj[' 1 ']);//3Console.log (obj[3]);//4 Console.log (obj[' Tom Ni hao ');//2Console.log (obj.tom);//undefined
What is an object? Object naming and access rules, mainly numeric and special words such as key names