随笔分类 - ES6 ~ ES11
摘要:
1 // 数组方法:find() 和 filter() 和some()和 findIndex() (都不会改变原数组, 但是 filter是纯函数; 纯函数: 1.不改变原数组(没有副作用) ; 2. 返回一个数组) 2 // find() :用于找出 第一个 符合条件的数组成员(不会继续往下执行)
阅读全文
1 // 数组方法:find() 和 filter() 和some()和 findIndex() (都不会改变原数组, 但是 filter是纯函数; 纯函数: 1.不改变原数组(没有副作用) ; 2. 返回一个数组) 2 // find() :用于找出 第一个 符合条件的数组成员(不会继续往下执行)
阅读全文
摘要:本地 data.json 文件 { "name": "大熊", "age": 18, "fnc": [ 1, 2, 3 ] } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" c
阅读全文
摘要:// 以前的取值方法 const course = { name: '大熊', age: 23 } // const name = course.name; // const age = course.age; // console.log(name, age) // 1.解构赋值 const {
阅读全文
摘要:const 申明常量 var str = 'es6' console.log(window.str) // es6 属于顶层对象window const不属于顶层对象window const str = 'es6' console.log(window.str) //undefined 不属于顶层对
阅读全文
摘要:这里介绍 五种方法(说白了本质 就三种) 1.callback回调函数 function getData(callback){ setTimeout(()=>{ let name = '哈哈哈,我是callback回调函数 获取异步方法里面的数据'; callback(name) },1000) }
阅读全文
摘要:转载地址:https://www.cnblogs.com/sghy/p/8005857.html 一、定义类(ES6的类,完全可以看做是构造函数的另一种写法) class Greet { constructor(x, y) { this.x = x; this.y = y; } sayHello()
阅读全文
摘要:转载地址:https://www.cnblogs.com/sghy/p/7987640.html 定义:Async函数是一个异步操作函数,本质上,Async函数是Generator函数的语法糖。async函数就是将 Generator 函数的星号(*)替换成async,将yield替换成await,
阅读全文
摘要://es6语法之`${}`以及vue语法 `${ }` (模版字符串)const name = '小缘' const age = 14 console.info(`大家好,我叫${name},今年${age}岁了`) // 等价于 console.info('大家好,我叫' + name + ',今
阅读全文
摘要:在最新的ES7(ES2017)中提出的前端异步特性:async、await。 什么是async、await? async顾名思义是“异步”的意思,async用于声明一个函数是异步的。而await从字面意思上是“等待”的意思,就是用于等待异步完成。并且await只能在async函数中使用 通常asyn
阅读全文
摘要:Promise.all([ 需要异步一起执行的方法 先做的事 ]).then(res=>{ 后做的事(先做的事已经做好了) }) 举栗子🌰: Promise.all([ this.aaa() this.bbb() ]).then((res)=>{ this.ccc() });
阅读全文

浙公网安备 33010602011771号