我不确定这个结构意味着什么,但我已经看过几次了.下面的示例来自另一个Stack Overflow问题.我不确定如何解释最初的"或"构造本身:
Object.keys = Object.keys || (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"),
DontEnums = [
'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty',
'isPrototypeOf', 'propertyIsEnumerable', 'constructor'
],
DontEnumsLength = DontEnums.length;
//etc...
});
Run Code Online (Sandbox Code Playgroud)