8-2.txt
来自「Javascript语言开发经典教程开发」· 文本 代码 · 共 17 行
TXT
17 行
// This function uses the this keyword, so it doesn't make sense to// invoke it by itself; it needs instead to be made a method of some// object that has "width" and "height" properties defined.function compute_area(){ return this.width * this.height;}// Create a new Rectangle object, using the constructor defined earlier.var page = new Rectangle(8.5, 11);// Define a method by assigning the function to a property of the object.page.area = compute_area;// Invoke the new method like this:var a = page.area(); // a = 8.5*11 = 93.5
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?