![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
学习记录
愿煜愁殇
无~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
展开
-
模拟几个函数的实现
在基础知识的学习中要注重深入,模拟一些常用函数的学习便是很好的办法,一下皆是本人学习记录,无关对错 模拟bind Function.prototype.newBind = function (target, ...args){ target = target || window let self = this let temp = function ()...原创 2018-09-05 13:37:55 · 192 阅读 · 0 评论 -
拖拽功能函数
实现拖拽功能的简单函数 class Drag{ constructor(el){ this.el = document.querySelector(el) this.distance = { x: 0, y: 0 } this.init() ...原创 2018-09-06 13:50:06 · 241 阅读 · 0 评论 -
Map 和 Set
Map是一种类似于json的数据格式,map的键key可以是任意类型*/ let m = new Map() // 添加 m.set(123, 'abc').set(234, 'bcd').set(456, 'doh') // 获取 m.get(123) // 'abc' // 删除 m.delete(456) // 判断是否有key m.has(123) //true // 清空...原创 2018-09-06 20:29:34 · 85 阅读 · 0 评论 -
es6关于数组的几个函数
关于数组的函数 map map遍历方法的回调函数里有三个参数,(val, index, all),分别代表值、下标、被循环的数组。 let arr = [{title:'new1',read:200,hot:true}, {title:'new2',read:300,hot:true}, {title:'new3',read:400,hot:tru...原创 2018-09-06 21:13:57 · 295 阅读 · 0 评论 -
generator 与 async await
generator 函数 可用于解决异步的深度嵌套,函数与函数名间加上* 就能成为generator函数,next() 依次执行yield域,return后结束 function * show(){ yield 'welcome'; yield 'to'; return 'toilet' } let a = show(); console.log(a.next(...原创 2018-09-07 14:10:00 · 460 阅读 · 0 评论