![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javascript
aneprwe
这个作者很懒,什么都没留下…
展开
-
JS数组方法
flat() 数组扁平化。 const arr1 = [0, 1, 2, [3, 4]]; console.log(arr1.flat()); // [0, 1, 2, 3, 4] 使用Infinity可以展开任意深度的嵌套数组 const arr2 = [0, 1, [2, [[[3, 4]]]]]; console.log(arr1.flat(Infinity)) // [0, 1, 2, 3, 4] reduce() 对数组的每一项执行指定的函数 arr.reduce(callback(acc,原创 2020-10-15 11:42:22 · 156 阅读 · 0 评论 -
《你不知道的JavaScript》上笔记
作用域 JavaScript中有函数作用域,没有块作用域 块作用域 with:with 从对象中创建出的作用域仅在 with 声明中有效 try…catch的catch会创建一个块作用域 let:let可以将变量绑定到所在的任意作用域中 变量提升 变量和函数的声明会从它出现的位置被移动到作用域的最上面。每个作用域都会进行变量提升。函数优先被提升,然后才是变量 闭包 闭包: 函数可以记住,并访问...原创 2020-04-19 17:33:30 · 125 阅读 · 0 评论 -
canvas基础
canvas基础原创 2017-10-12 21:57:41 · 190 阅读 · 0 评论