{}" mean in JavaScript
This question already has an answer here:
That line of code does the following:
IF variable
is not defined (or has a falsey value) THEN set it to an empty object.
ELSE do nothing (technically speaking, variable
gets assigned to itself)
In other words variable
will be converted to an empty object if it is any of the following:
See toBoolean for the spec's definition of falsey values.
如果变量已经存在,则使用它,否则创建一个空对象
如果变量未定义或为false,则将其初始化为空对象。
链接地址: http://www.djcxy.com/p/95280.html上一篇: {}是否代表JavaScript?
下一篇: {}“的意思是在JavaScript中