View Full Version : Computer object

01-01-2011, 10: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

01-01-2011, 10:06 PM
did you have a question? The code looks to be correctly creating the object you desire.

01-02-2011, 12:04 PM
document.write() may have wiped your page.