Hi All
I’m being asked to ‘define (add two) properties to the custom objects’. My code seems correct but when I upload the html page it should say ‘My trainers are Nike’. But only the Paragraph ‘Define (add two) properties to the custom objects’ appears. I’ve attached the code below.
Can anyone help?
<!DOCTYPE html>
<html>
<body>
<p>My Define (add two) properties to the custom objects</p>
<p id=”dan2″></p>
<script>
function trainers(make, model, colour) {
this.make = make;
this.model = model;
this.colour = colour;
this.changeTrainerMake = function (newTrainerMake) {
this.make = newTrainerMake;
}
}
var trainers1 = new trainers(“Addidas”,”UltraBoost”,”Grey”);
trainer1.changeTrainerMake(“Nike”);
document.getElementById(“dan2”).innerHTML =
“My trainers are ” + trainers1.make;
</script>
</body>
</html>
Best wishes