2
JS Assignment 13 Intro to Classes in Javascript
nda1 (1)

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
1
a5rocks (502)

if everyone else's answers don't work, check out constructors.

1
ArchieMaclean (524)

@a5rocks Constructors are for classes I think, like

class A {
  constructor(a,b,c) {
    // blah
  }
}

Not JS's weird function-class things.

Maybe it works with them as well, but it's not needed here I don't think :)

1
nda1 (1)

@ArchieMaclean I figured it out the program did not want the extra
function ClassOne(name, pw, mail).

it accepted just >>
this.username = name;
this.password = pw;
this.email = mail;
thank you so much for all the help you gave me, you truly were a lifesaver. :)

1
ArchieMaclean (524)

@nda1 Good, I'm glad it worked out :)