分类:代码段

代码段

js WeakSet

js WeakSet
不允许重复值 let weakObj = new WeakSet() let obj = {a: 'wanjunshijie', b: 'wanjunshijie.com'} weakObj.add(obj) console.log(weakObj...

yekong 3年前 (2021-09-07) 喜欢

js 对象元素保护

js 对象元素保护
let a = Symbol(); let obj = { [a]: 'wanjunshijie' } console.log(obj[a]) obj[a] = 'web' console.log(obj[a]) let a = Symb...

yekong 3年前 (2021-09-07) 喜欢

js 合并对象

js 合并对象
Object.assign let a = {a: 'wanjunshijie'} let b = {b: '完俊世界'} let c = {c: 'web'} let d = Object.assign(a, b, c) cons...

yekong 3年前 (2021-09-07) 喜欢

js ===和Object.js的区别?

js ===和Object.js的区别?
===同值相等 Object.js严格相等 console.log(+0===-0) //true console.log(NaN===NaN) //false console.log(Object.is(+0,-0)) //false console.log(Object.i...

yekong 3年前 (2021-09-07) 喜欢