- 博客(3)
- 收藏
- 关注
转载 ES6笔记--剩余参数
剩余参数也用三个连续的点 ( ... ) 表示,使你能够将不定数量的元素表示为数组。它在多种情形下都比较有用。一种情形是将变量赋数组值时。例如,const order = [20.17, 18.67, 1.50, "cheese", "eggs", "milk", "bread"]; const [total, subtotal, tax, ...items] = order; console.l...
2018-04-27 16:19:36
996
转载 ES6笔记--展开运算符
展开运算符(用三个连续的点 ( ... ) 表示)是 ES6 中的新概念,使你能够将字面量对象展开为多个元素。我们通过几个示例看看它的原理。const books = ["Don Quixote", "The Hobbit", "Alice in Wonderland", "Tale of Two Cities"]; console.log(...books); Prints: Don Quixo...
2018-04-27 16:15:41
1574
转载 ES6笔记--For...of循环
for...of 循环用于循环访问任何可迭代的数据类型。for...of 循环的编写方式和 for...in 循环的基本一样,只是将 in 替换为 of,可以忽略索引。例如:const digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; for (const digit of digits) { console.log(digit); }实战:编写符合以下条件的...
2018-04-27 16:12:29
428
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅