上一页 1 ··· 7 8 9 10 11
摘要: 不带原型的对象,纯对象 const plaintObject = Object.create(null) 带原型的对象 const originObject = new Object() 阅读全文
posted @ 2020-07-21 23:15 荣光无限 阅读(515) 评论(0) 推荐(0) 编辑
摘要: Blob Binary Large Object的缩写,二进制大对象 虽然在前端中开发并不常见,但是实际上MySql数据库中,可以通过设置一个Blob类型的数据来存储一个Blob对象的内容 语法 let blob = new Blob(Array,options) // 参数Array: 是由一个` 阅读全文
posted @ 2020-07-21 17:51 荣光无限 阅读(1071) 评论(0) 推荐(0) 编辑
摘要: 使用 ES2019中的新特性 Array.prototype.flat() const arr = [1,2,3,4,[10,20,30]] const res = arr.flat() console.info(res) // [1,2,3,4,10,20,30] 使用 reduce, 递归数组 阅读全文
posted @ 2020-07-21 16:59 荣光无限 阅读(158) 评论(0) 推荐(0) 编辑
摘要: async 作用: async函数返回一个 Promise对象,无论内部有没有await关键字. await 作用: await等待的是一个表达式,这个表达式的计算结果是 Promise 对象 或者是其他值 (await可以等待任意表达式的结果) 如果await的不是一个Promise对象, 那 a 阅读全文
posted @ 2020-07-21 10:18 荣光无限 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 作用: 改变函数执行时的作用域 let name = 'global name' function say(){ console.info(arguments) // 调用时接收的参数个数 console.info(this.name) } var obj = { name: 'obj name' 阅读全文
posted @ 2020-07-21 09:33 荣光无限 阅读(109) 评论(0) 推荐(0) 编辑
摘要: getOwnPropertyDescriptor and defineProperty function def (obj, key, val, enumerable) { Object.defineProperty(obj, key, { value: val, enumerable: !!enu 阅读全文
posted @ 2020-07-21 09:30 荣光无限 阅读(86) 评论(0) 推荐(0) 编辑
摘要: const { info } = console // cooking function cook() { info('[COOKING] start cooking.') const p = new Promise((resolve, reject) => { setTimeout(() => { 阅读全文
posted @ 2020-07-21 09:16 荣光无限 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 一个函数如果被 async 修饰,无论内部是否有 await的异步操作,都会返回一个 Promise 对象 demo 1 async function basicAsync() { let result = await (Math.random() * 200).toFixed(2) console 阅读全文
posted @ 2020-07-21 09:15 荣光无限 阅读(302) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11