<script type="text/javascript"> function Animal() { this.name = "Animal"; this.Say = function () { console.log(this); console.log(this.name); } } function Cat() { this.name = "Cat"; } var animal = new Animal(); var cat = new Cat(); //animal.Say(); animal.Say.call(cat);是不是 .調(diào)用animal.Say里面的this已經(jīng)切換到指向cat對象,所以console.log(this);打印了catconsole.log(this.name); 打印了cat這個call好懵逼呀,到底是什么東西..我實在搞不懂能不能來個例子 或者給我解釋一下 , ,謝謝了
js中call的詳細介紹
回首憶惘然
2018-07-09 10:08:31