LoginSignup
0
0

More than 5 years have passed since last update.

コンテキストによって指し示すthisの違い

Posted at

<html lang="ja">
<head>
<meta charset="utf-8"/>
<script>
  ///////////////////////////
function Dog(){
this.age = 3;
this.name = 'pochi';
};
///////////////////////////
//ここではfunction Dogのthisを実行しているのはDogオブジェクト。
//コンストラクタにインスタンスするときはnewの後に半角1文字のスペースを開ける。
var anyDog = new Dog();
console.log(Dog);
</script>

    </style>
</head>
<body>
    <div id="container">
        <div id="target">
        </div>
    </div>
</body>

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