jls1988
01-01-2011, 09:02 PM
Hey guys,
I need to create a constructor for a computer object. This object must have three properties: speed, and mem_live mem_dead. Then I need to create a new object using this constructor and then have its properties displayed on the screen.
Look at what I'm up to so far:
function Computer(speed, mem_live, mem_dead)
{
this.speed = speed;
this.mem_live = mem_live;
this.mem_dead = mem_dead;
}
var computer1 = new Computer("4.0ghz", true, false);
document.write(computer1.speed + " " + computer1.mem_live + " " + computer1.mem_dead);
What am I doing wrong? It always just shows : 4.0ghz, true, false
I need to create a constructor for a computer object. This object must have three properties: speed, and mem_live mem_dead. Then I need to create a new object using this constructor and then have its properties displayed on the screen.
Look at what I'm up to so far:
function Computer(speed, mem_live, mem_dead)
{
this.speed = speed;
this.mem_live = mem_live;
this.mem_dead = mem_dead;
}
var computer1 = new Computer("4.0ghz", true, false);
document.write(computer1.speed + " " + computer1.mem_live + " " + computer1.mem_dead);
What am I doing wrong? It always just shows : 4.0ghz, true, false