ES6 语法详解(对象扩展)
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> </body> <script type="text/javascript"> /** * Object.is(v1,v2) * 判断两个数据是是否完全相等 * Object.assign(target,source1,source2...) * 将源对象的属性复制到目标对象上 * 直接操作__proto__属性 * let obj2 = {}; * obj2.__proto__ = obj1; */ /** * 特殊 */ console.log(0 == -0) console.log(NaN == NaN) console.log(Object.is(0,-0)) console.log(Object.is(NaN,NaN)) let my = {} let name = {usernam: 'flower'} let age = {age:18} Object.assign(my,name,age) console.log(my) // 直接操作隐式原型 let objP = {qian:50000000} let objS = {} objS.__proto__ = objP console.log(objS) console.log(objS.qian) </script> </html>
作者:彼岸舞
时间:2021\08\16
内容关于:前端知识库
本文属于作者原创,未经允许,禁止转发