JS Assignment 13 Intro to Classes in Javascript
nda1 (3)

Hey could anyone who has done the lambda precourse work help me, I do not understand why my answer is wrong. here is the assignment link: https://repl.it/student/submissions/6438375

function ClassOne(name, pw, mail){
// Exercise One: In this exercise you will be creating your own class!
// You are currently in the class, you are given three strings, name, pw, and mail.
// You need to create three properties on this class.
// Those properties are: 'username', 'password', and 'email'
// Set the value of username to name,
// Set the value of password to pw,
// Set the value of email to mail

this was my answer>>>
function ClassOne(username, password, email) {
this.username = name;
this.password = pw;
this.email = mail;
}

You are viewing a single comment. View All
ArchieMaclean (614)

@nda1 No not like that. I'm just going to give you the solution.
Your code is like this:

function ClassOne(username, password, email) {
  this.username = name;
  this.password = pw;
  this.email = mail;
}

However, I have explained above that this doesn't work. To fix it, you need to do this:

function ClassOne(name,pw,mail) {     // this has been changed
  this.username = name;
  this.password = pw;
  this.email = mail;
}

Now you've done that, the computer knows what name, pw and mail are, so it runs.