摘要: 检测构造函数的 prototype 属性是否出现在某个实例对象的原型链上。 function Car(make, model, year) { this.make = make; this.model = model; this.year = year; } const auto = new Car 阅读全文
posted @ 2021-11-17 16:28 Redchar 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 1. 数组includes()方法,用来判断一个数组是否包含一个指定的值,根据情况,如果包含则返回true,否则返回false。 2. a ** b指数运算符,它与 Math.pow(a, b)相同 简析: 1. includes(), 即indexOf(x) > -1 list.includes( 阅读全文
posted @ 2021-11-17 16:13 Redchar 阅读(26) 评论(0) 推荐(0) 编辑
摘要: async/await: 异步终极解决方案 Object.values() Object.entries() String padding:String.prototype.padStart、String.prototype.padEnd 函数参数列表结尾允许逗号 Object.getOwnProp 阅读全文
posted @ 2021-11-17 16:05 Redchar 阅读(31) 评论(0) 推荐(0) 编辑
摘要: //删除起始下标为1,长度为1的一个值(len设置1,如果为0,则数组不变) var arr = ['a','b','c','d']; arr.splice(1,1); console.log(arr); //['a','c','d']; //替换起始下标为1,长度为1的一个值为‘ttt’,len设 阅读全文
posted @ 2021-11-17 15:15 Redchar 阅读(163) 评论(0) 推荐(0) 编辑
摘要: const object1 = { a: 'somestring', b: 42 }; for (const [key, value] of Object.entries(object1)) { console.log(`${key}: ${value}`); } // expected outpu 阅读全文
posted @ 2021-11-17 15:08 Redchar 阅读(29) 评论(0) 推荐(0) 编辑