admin管理员组文章数量:1310034
Can someone tell me what exactly the two above lines of javascript do? And more importantly, what it's called so I can search some javascript references to learn about it? I assume they are both creating some form of an array that objects can be added to...?
Can someone tell me what exactly the two above lines of javascript do? And more importantly, what it's called so I can search some javascript references to learn about it? I assume they are both creating some form of an array that objects can be added to...?
Share Improve this question edited Dec 20, 2015 at 22:35 Termininja 7,03612 gold badges50 silver badges50 bronze badges asked Jan 6, 2009 at 6:08 WavelWavel 9668 silver badges32 bronze badges2 Answers
Reset to default 8Curly braces are syntax for creating a Javascript object (which is really a glorified collection of key/value pairs); the brackets make a resizable array.
These are called literals, and they're a handy shortcut to help you make objects and arrays without a lot of typing (good, because you use them all the time). Many other programming languages have similar literal syntax for maps and arrays.
It creates an empty dictionary in map
and an empty array in list
.
Read up on these structures at http://www.geocities./schools_ring/ArrayAndHash.html.
本文标签: arraysJavascript var map var listStack Overflow
版权声明:本文标题:arrays - Javascript: var map = {}; var list = []; - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741819549a2399283.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论