0
1

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 3 years have passed since last update.

【JavaScript】JSのオブジェクトの書き方【初心者】

Posted at

#超初心者向けです。

index_3.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="js/jquery-3.4.1.min.js"></script>
</head>
<body>
  <h1>object更新</h1>

  <script>
    
    // 定数を設定して配列を代入する
    const person = {
      id: 1,
      name: "suzuki",
      age: 29,
    };

    // 配列の中の名前をtanakaに変更する場合
    person.name = "tanaka";

    // 関数を定義して、コンソールに配列の中身をそれぞれ表示させる処理を書く。
    const write = () => {
      console.log(person.id);
      console.log(person.name);
      console.log(person.age);
    }
    // 実際に関数を実行
    write();

  </script>
</body>
</html>
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?