javascript destructuring.js

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript destructuring.js相关的知识,希望对你有一定的参考价值。

/*
 * Programming Quiz: Destructuring Arrays (1-3)
 *
 * Use destructuring to initialize the variables `one`, `two`, and `three`
 * with the colors from the `things` array.
 */

const things = ['red', 'basketball', 'paperclip', 'green', 'computer', 'earth', 'udacity', 'blue', 'dogs'];

const [one, , , two, , , , three] = things;

const colors = `List of Colors
1. ${one}
2. ${two}
3. ${three}`;

console.log(colors);

以上是关于javascript destructuring.js的主要内容,如果未能解决你的问题,请参考以下文章

必须使用解构道具分配(react/destructuring-assignment)

解构声明(Destructuring Declarations)

markdown React_destructuring_simplify

Babel:无法让“@babel/plugin-transform-destructuring”插件工作

杂记rust的destructuring binding(反结构化绑定)与ownership(所有权)

TypeError: Cannot destructure property `compile` of 'undefined' or 'null'