![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES6
想搞全栈的前端
愿君学长松,慎勿作桃李.受屈不改心,然后知君子
展开
-
手写promise
手写promisepromise.jsclass Promise { constructor(executor) { // 参数校检 if (typeof executor !== 'function') { throw new TypeError(`Promise resolver ${executor} is not a function`) } this.initValue() this.initBind() try {原创 2022-02-22 17:02:34 · 173 阅读 · 0 评论 -
es6 class类小demo
使用如下代码<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title></title> </head> <style> </style> <body> </body></html><script src="jquery.min.js"></script>原创 2021-03-30 11:15:40 · 165 阅读 · 0 评论 -
一张思维导图回顾ES6所有新方法(预览ES7)
原创 2019-10-25 15:59:47 · 281 阅读 · 0 评论 -
ES6新语法汇总
ES6新语法hello-es61.ES6怎么来的2.ES6兼容性3.变量 let 和 常量 const4.函数-箭头函数5.函数-参数6.解构赋值7.数组8.字符串9.面向对象-基础10.面向对象应用11.json12.Promise13.generator-认识生成器函数14.generator-yield是啥15.generator-实例16.ES7 预览...原创 2019-10-22 15:36:59 · 446 阅读 · 0 评论 -
ES6学习笔记
1.变量 var 重复申明、函数级作用域 let 不能重复申明、块级作用域、变量 const 不能重复申明、块级作用域、常量2.箭头函数 a.方便 i.如果只有一个参数,()可以省 ii.如果只有一个return,{}可以省 b.修正this this相对正常点3.参数扩展 收集 扩展 默认参数 function show(a,b=5...原创 2019-04-15 09:10:05 · 147 阅读 · 0 评论 -
如何用 async/await 来处理异步
前言ES7的async/await语法在2016年就已经提出来了,用async/ await来发送异步请求,从服务端获取数据,代码很简洁,async/await 也已经被标准化。async先说一下async的用法,它作为一个关键字放到函数前面,用于表示函数是一个异步函数,因为async就是异步的意思, 异步函数也就意味着该函数的执行不会阻塞后面代码的执行。 写一个async 函数:asyn...原创 2019-06-23 19:43:31 · 1468 阅读 · 2 评论