摘要: Promise 基本定义 es5 中的回调 { let ajax = function (callback) { console.log('执行') setTimeout(() => { callback && callback.call() }, 1000) } ajax(function () 阅读全文
posted @ 2019-11-08 20:08 Helzeo 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 基本语法 { // 基本定义和生成实例 class Parent { // 定义构造函数 constructor (name = 'LiMing') { this.name = name } } // 生成实例 let parent = new Parent('Helzeo') console.lo 阅读全文
posted @ 2019-11-08 19:14 Helzeo 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Proxy { let obj = { time: '2019-11-08', name: 'Helzeo', _r: 858511254 } let monitor = new Proxy(obj, { // 拦截对象属性的读取, 把要读取数据的 key 的值含有 2019 的 替换成 2020 阅读全文
posted @ 2019-11-08 16:44 Helzeo 阅读(132) 评论(0) 推荐(0) 编辑
摘要: map 与 Array 增查改删的对比 { let map = new Map() let array = [] // 增 map.set('t', 1) array.push({t: 1}) console.log('map', map) // Map(1) {"t" => 1} console. 阅读全文
posted @ 2019-11-08 14:33 Helzeo 阅读(324) 评论(0) 推荐(0) 编辑