Number.prototype.isInteger = Number.prototype.isInteger || function(x) {
return (x ^ 0) === x;
}
console.log(Number.isInteger(1));Run Code Online (Sandbox Code Playgroud)
将在IE10浏览器中抛出错误
考虑:
{
"one": {
"one1":"one11",
"System Name":"ssss"
},
"two2": [
["two20", "two200"]
]
}
Run Code Online (Sandbox Code Playgroud)
如果我使用'/* comments */'或//comments,我无法获取JSON数据。
但我的数据太多了,我必须添加评论。
还有其他方法吗?
var obj = {
name: 'hello',
getName: function(){
return () => {return this.name; }
}
}
var name = 'world';
var nameFunc = obj.getName();
console.log(nameFunc())
Run Code Online (Sandbox Code Playgroud)
结果是"你好",而不是"世界".我有点困惑.