{} means in JavaScript?
This question already has an answer here:
window.google = window.google || {};
意思是如果window.google没有设置,它会创建一个新的对象。
It initializes the object if the object is not initialized.
After creating the object, you have to init it because the results can be unpredictable without init... Without init, the value is undefined (not 0, not null, undefined).
This means that if window.google
doesn't have value (undefined, null)
then use {}
.
It is a way of assigning a default value to a variable in JavaScript.
链接地址: http://www.djcxy.com/p/95282.html上一篇: 我不明白这个代码
下一篇: {}是否代表JavaScript?