KamYee

随笔分类 -  前端

摘要:var a = {n: 1}; var b = a; a.x = a = {n: 2}; console.log(a.x) // undefined console.log(b.x) // {n: 2} 解答: 点的优先级高于等号,所以先执行a.x 然后在从右执行赋值 传送门 mdn 优先级运算类型 阅读全文
posted @ 2020-03-05 10:45 KamYee
摘要:for...in for...in语句以任意顺序遍历一个对象的除Symbol以外的可枚举属性。 for...in会循环原型链上的属性 function test() { } test.prototype.testa = '123123' var c1 = new test() c1.testb = 阅读全文
posted @ 2020-03-04 17:11 KamYee