0
0

オブジェクトの分割代入について

Posted at

配列を使って一気に変数を宣言する際に、,やスプレッド構文を使って

  • 特定の値の取得
  • いらない値の選別

ができる

const a = [1,2,3,4,5]
const [ ,b,...rest] = a
console.log(b,rest) // 2 [ 3, 4, 5 ]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0