HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
JS
格式化
//包含值为 undefined,null,包含原形链上的
function hasProps(obj,key) {
// return Object.keys(obj).includes(key) || Object.keys(Object.getPrototypeOf(obj)).includes(key)
return key in obj;
}
let obj = Object.create({a:2, b: undefined, c: null})
// let obj = {a:2, b: undefined, c: null}
console.log(obj.a)
console.log(hasProps(obj,'a'));
console.log(hasProps(obj,'b'));
console.log(hasProps(obj,'c'));
console.log(hasProps(obj,'d'));