随笔分类 -  JavaScript随笔

个人学习历程随笔
摘要:1. 解构分为解构数组和解构对象 参考 https://www.runoob.com/w3cnote/deconstruction-assignment.html 【仅作为个人学习转载记录】 2. 结合 剩余参数 代码示例: // 解构数组 let arr = ['blue', 'pink', 'g 阅读全文
posted @ 2021-08-09 17:43 TwinkleG 阅读(234) 评论(0) 推荐(0)
摘要:【this一般指向自身所处函数的调用者】 箭头函数自身不具备this,箭头函数中的this等于定义箭头函数位置的this let obj = { name: "James" }; function funcThisTest() { console.log(this); return function 阅读全文
posted @ 2021-08-09 17:18 TwinkleG 阅读(55) 评论(0) 推荐(0)
摘要:1. 若函数体只有一句代码,且代码执行结果为返回值,则函数体大括号以及return可省略 正常函数形式: let normal_func = function (num1, num2) { return num1 + num2; }; 使用箭头函数形式: let arrow_func = (num1 阅读全文
posted @ 2021-08-09 17:10 TwinkleG 阅读(45) 评论(0) 推荐(0)
摘要:let的特性: 【ES6是指ES2015以及之后的更新版本,即ES2016、ES2017......】 1. 具有块级作用域 if (true) { var num = 10; console.log(num); // 10 } console.log(num); // 'num' is not d 阅读全文
posted @ 2021-08-09 16:35 TwinkleG 阅读(72) 评论(0) 推荐(0)