JavaScript 方法是包含函数定义的属性
JavaScript 方法是能够在对象上执行的动作。
JavaScript 方法是包含函数定义的属性。
属性 值
firstName Bill
lastName Gates
age 62
eyeColor blue
fullName function() {return this.firstName + " " + this.lastName;}
方法是存储为对象属性的函数。
this 关键词
在 JavaScript 中,被称为 this 的事物,指的是拥有该 JavaScript 代码的对象。
this 的值,在函数中使用时,是“拥有”该函数的对象。
请注意 this 并非变量。它是关键词。您无法改变 this 的值。
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h64469.shtml