Menu
<!DOCTYPE html>
<html>
<body>
<p>Creating and using an object method</p>
<p id=”demo”></p>
<script>
function car(make,model,colour) {
this.make = make;
this.model = model;
this.colour = colour;
this.changeCarMake = function (newCarMake) {
this.make = newCarMake;
}
}
var car1 = new car(“Ford”,”Focus”,”Black”);
car1.changeCarMake(“BMW”);
document.getElementById(“demo”).innerHTML =
“My new car is a ” + car1.make;
</script>
</body>
</html>
I have the following code which uses a custom object. Can anyone add array code which makes use of this custom object?