Try to search your question here, if you can't find : Ask Any Question Now ?

Hello. Trying to create properties in a class then set their Value

HomeCategory: stackoverflowHello. Trying to create properties in a class then set their Value
gaurav asked 2 weeks ago

I thought I got it right but the error says:

Failed tests:
Should be a class with name, email, and password properties.
Expected undefined to be ‘Dan’.

I looked on MDN and w3schools but apparently I am just not understanding it. I know I am close though.

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 */
    }
  function User(username, password, email) {
      this.username = 'name';                 //<-------My Code
      this.password = 'pw';                   //<-------My Code
      this.email = 'mail';                    //<-------My Code
  }
 const dan = new User ('Dan', '123xyz', 'dan@aol.com');          //<-------My Code
1 Answers
Best Answer
Jyoti answered 2 weeks ago
Your Answer

16 + 20 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com