日期:2014-05-16 浏览次数:20367 次
var car = function(brand, color) { this.start() { } }
var people = function() { this.startCar() { var car = new car("大众", "黑色"); car.start(); } }
var car = function(brand, color) { this.start = function() { } } var people = function() { this.startCar = function() { var car = new car("大众", "黑色"); car.start(); } }
------解决方案--------------------
var car = function(brand, color) { } car.prototype = { start:function(){} } var people = function() { this.startCar = function() { var car = new car("大众", "黑色"); car.start(); } }
------解决方案--------------------
function car(brand, color){
this.start() {
};
};
------解决方案--------------------
你对对象的属性怎么构造还没有弄清楚
var car = function(brand, color) { this.start=function(){ } }; var people = function() { this.startCar=function(){ var car = new car("大众", "黑色"); car.start(); } } var a=new car();