/    Sign up×
Community /Pin to ProfileBookmark

define (add two) properties to the custom objects

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

to post a comment
CSSFull-stack Developer

4 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumMar 20.2019 — There seems to be a typo here:
var trainers1 = new trainers("Addidas","UltraBoost","Grey");
trainer1.changeTrainerMake("Nike");
trainer[b]s[/b]1 vs. trainer
Copy linkTweet thisAlerts:
@bobbed12authorMar 20.2019 — Thanks, I'm new to this but I do that kind of mistake a lot. Could be down to my dyslexia.

Grateful for your help.
Copy linkTweet thisAlerts:
@rootMar 21.2019 — {"locked":true}
Copy linkTweet thisAlerts:
@rootMar 21.2019 — *Locked* Duplicate post, Please do not post more than one thread with the same code issues, thanks.
×

Success!

Help @bobbed12 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 3.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...