摘要: 1 function Polygon(sides) { 2 if (this instanceof Polygon) { 3 this.sides = sides; 4 this.getArea = function() { 5 return 0; 6 }; 7 } else { 8 return new Polygon(sides); 9 }10 }11 12 function Rectangle(width, height) {13 Polygon.call(this,... 阅读全文
posted @ 2012-06-08 16:20 小猩猩君 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 1 function Person(name, age, job) { 2 if (this instanceof Person) { 3 this.name = name; 4 this.age = age; 5 this.job = job; 6 } else { 7 return new Person(name, age, job); 8 } 9 }10 11 var person1 = Person("Nicholas", 29, "Software Engineer");12 console.l... 阅读全文
posted @ 2012-06-08 15:59 小猩猩君 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-08 11:19 小猩猩君 阅读(779) 评论(0) 推荐(0) 编辑