上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: 1.原始值转 console.log(Number(null)) // 0console.log(Number(undefined)) // NaNfalsey(虚值): false 0 '' undefined null 除了虚值都是真值![] // false!{} // false 2.对象转 阅读全文
posted @ 2021-08-20 14:35 卷叶小树 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1.函数柯理化 大函数返回小函数 思想:利用闭包的机制(保存),将一些内容提前存储和处理,在某个阶段之后拿来用即可 2.应用 2.1 预处理内容返回一个代理函数 /* * bind预先处理内容 * @params: * func:要执行的函数 * context:要改变的this指向 * args: 阅读全文
posted @ 2021-08-18 18:46 卷叶小树 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 1.语法 func.call(_this,arg1,arg2) func.apply(_this,[arg1,arg2]) func.bind(_this,arg1,arg2)() 2.call、apply、bind实现 实现原理: 都是Function.prototype上的方法 第一个参数没传, 阅读全文
posted @ 2021-08-18 16:10 卷叶小树 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 1.浅拷贝 浅拷贝:for...in 三点运算符 Object.assign() Array.prototype.slice() Array.prototype.concat()等 2.深拷贝 2.1.JSON.parse(JSON.stringify(obj)) 问题: 不能考本function 阅读全文
posted @ 2021-08-18 14:52 卷叶小树 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1.语言内部的方法,与对象关系不大,放到Reflect上 let obj = {color:'red'} Reflect.preventExtensions(obj) // Object.preventExtensions(obj) obj.num = 100 console.log(obj) 2. 阅读全文
posted @ 2021-08-16 20:47 卷叶小树 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 1.语法 let proxy = new Proxy(target,handler) let star = { name:"尼古拉斯凯奇", age:40, job:"actor", phone:"18900012345" } let proxy = new Proxy(star,{ get(tar 阅读全文
posted @ 2021-08-16 13:27 卷叶小树 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 1.对象字面变量 2.对象解构,...运算符 3.name属性 4.特性方法(get、set定义是a56爆大奖在线娱乐方法获取) let descriptor = Object.getOwnPropertyDescriptor(obj,'num')console.log(descriptor.get.name)con 阅读全文
posted @ 2021-08-11 14:46 卷叶小树 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 1.类方法 Array.from() 将类数组转数组Array.of() 创建数组 // Array.from() const divs = document.getElementsByTagName('div') Array.from(divs).forEach(v => { console.lo 阅读全文
posted @ 2021-08-10 20:33 卷叶小树 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 1.es7 1.1.绑定作用域 context::fn 等价于 fn.bind(context) const divs = document.getElementsByClassName('div') Array.prototype.forEach.bind(divs,function (...ar 阅读全文
posted @ 2021-08-06 13:18 卷叶小树 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 1.默认参数 默认参数导致函数在执行时,先执行参数体,再执行函数体 2.箭头函数 无法使用arguments,可通过获取剩余参数的语法代替不能做构造函数作用域是定义时的作用域,箭头函数不受严格模式影响,如果要修改其作用域,将其放到普通函数里箭头函数不能做generator,内部不能使用yeild关键 阅读全文
posted @ 2021-08-06 13:13 卷叶小树 阅读(30) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页