5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JavaScriptのObject.〇〇()を理解する

Last updated at Posted at 2017-06-08

Object.keys()ってなんね

そのままだけど、Objectに格納されているkeyを取り出してくれる

const obj = {
  name: "aaa",
  age: 23,
  gender: "F",
  key: "value",
};

Object.keys(obj); // => ["name", "age", "gender", "key"]

Object.assign(第1引数, 第2引数)ってなんね

状態を持たないオブジェクトに対してassign()を用いることで第1, 第2引数を入れる

Object.assign(第1引数, 第2引数)
------ ------
|       |_____ 被らなかったら追加、被った場合は上書き
|_ 状態持たない

※assign()の第1引数でnullが入る場合がある際は空のオブジェクト {} を定義しないとエラーになる

5
2
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
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?