0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JavaScript学習の記録2

Posted at

はじめに

前回に続いて,JavaScriptの学習内容をアウトプットします.

オブジェクトの省略記法

オブジェクトのプロパティと変数が同じ名前の場合,変数の部分を省略してもよい.

const myprofile = {
    name:name,
    age:age,
}

 ↓

const myprofile = {name, age}

スプレッド構文

「...」を使用する構文で,配列やオブジェクトに対して使用する.配列・オブジェクトの中身を順番に展開して,処理していくもの.

const arr = [1, 2];
console.log(...arr);

↓ 実行結果

1 2

スプレッド構文を使って配列を結合する

const arr1 = [10, 20];
const arr2 = [30, 40];

const arr3 = [...arr1, ..arr2];
console.log(arr3);

↓ 実行結果

[10, 20, 30, 40]
0
0
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?