2
3

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 1 year has passed since last update.

constで定義したオブジェクトと配列のプロパティは変更が可能

Posted at

はじめに

JavaScriptを書いてて、初歩的な箇所を勘違いしていたので、忘れないようにメモ。

constで定義したオブジェクトと配列のプロパティは変更が可能

// constで定義したオブジェクトのプロパティの変更が可能
const val = {
  name: "sasayoshi",
  age: 31
};
val.age = 30;
console.log(val);

// constて定義した配列の中身は変更が可能
const val2 = ["aaa", "bbb"];
val2[0] = "hoge";
val2.push("huga");
console.log(val2);

constで定義したオブジェクトと配列のプロパティは変更ができる。
スクリーンショット 2022-09-27 20.47.56.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?