上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: Symbol的获取和使用 const student = { name: "小明", age: 12, [Symbol("level")]: "优秀", [Symbol("level")]: "有钱" } 获取key值 console.log(Object.keys(student)) // ["n 阅读全文
posted @ 2021-07-29 17:42 `Duet` 阅读(297) 评论(0) 推荐(0) 编辑
摘要: Symbol基本概念 Symbol js的数据类型:数值、布尔、字符串、undefined、null、对象 ES6中加了一个新的数据类型 Symbol const sym = Symbol("abc") // 括号中的值是描述 console.log(sym) // Symbol(abc) cons 阅读全文
posted @ 2021-07-29 15:17 `Duet` 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 事件流 <style> .big{ width: 300px; height: 300px; background-color: red; } .center{ width: 200px; height: 200px; background-color: yellow; } .small{ widt 阅读全文
posted @ 2021-07-28 23:02 `Duet` 阅读(61) 评论(0) 推荐(0) 编辑
摘要: promise和async函数 promise let p = new Promise((resolve)=>{ resolve("hello world") }) p.then((data) => { console.log(data) // hello world }) async函数 // a 阅读全文
posted @ 2021-07-28 15:54 `Duet` 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 宏任务与微任务 宏任务: 计时器、ajax、读取文件 微任务: promise.then 执行顺序 1. 同步程序 2. process.nextTick 3. 微任务 4. 宏任务 5. setImmediate setImmediate(()=>{ console.log(1) }) conso 阅读全文
posted @ 2021-07-27 17:59 `Duet` 阅读(54) 评论(0) 推荐(0) 编辑
摘要: process.nextTick和setImmediate方法 setImmediate(()=>{ console.log(1) }) process.nextTick(()=>{ console.log(2) }) console.log(3) setTimeout(() => {console 阅读全文
posted @ 2021-07-27 17:47 `Duet` 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 同步和异步 同步:同步程序按顺序执行 console.log(1) console.log(2) console.log(3) 异步: 计时器(setTimeout,setInterval) ajax 读取文件 执行顺序 同步程序执行完成之后,执行异步程序 console.log(1) setTim 阅读全文
posted @ 2021-07-27 15:58 `Duet` 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 通过JSON拷贝 json数据格式 json全称:JavaScript对象表示法 [ { "name": "小明", "age": 2 },{ "name": "小刚", "age": 3 } ] jsons数据转换 let str = JSON.stringify(obj) // 将对象转换成js 阅读全文
posted @ 2021-07-26 22:27 `Duet` 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 深拷贝 递归的理解 递归:自己调用自己 // 计算累加 function fun(n){ if (n 1){ return 1 } else { return n + fun(n - 1) } } let res = fun(3) console.log(res) // 6 利用递归实现深度克隆 / 阅读全文
posted @ 2021-07-26 22:17 `Duet` 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 浅拷贝 首先看一个vue的例子 <script src="https://cdn.jsdelivr.net/npm/vue@2"></script> <div id="app"> <form @submit.prevent="insert"> <input type="text" v-model=" 阅读全文
posted @ 2021-07-26 22:00 `Duet` 阅读(55) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页