• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Hi everyone, I'm new on here. I have some issues with the below code which is a class assignment the first exercise is ok but the second one is not.


New Coder
Nov 14, 2019
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.username = name;
this.password = pw;
this.email = mail;
// Note: Remember you DO NOT need to return anything in a class!

function ClassTwo(name, pw, mail){
// Exercise Two: Now that you have created your own class,
// you will create a class with a method on it.
// In this class create 4 properties: username, password, email, and checkPassword.
// Set the value of username to name,
// Set the value of password to pw,
// Set the value of email to mail
// Set the value of checkPassword to a function.
// The checkPassword function takes a string as it's only argument.
// Using the 'this' keyword check to see if the password on the class is the same as
// the string being passed in as the parameter. Return true or false.

this.username = name;

this.password = pw;

this.email = mail;

this.checkPassword = function(string) {

return this.password;





Aug 21, 2019
Hey there!

In the second exercise, your checkPassword method needs to compare the password property of the class and the string passed as argument, and return true/false based on it.

So, your method should be like:

this.checkPassword = function(string) {

    return this.password == string;

  • Like
Reactions: dr3apap

Master Yoda

Jan 2, 2018
Hi there, please remember to place your code within the bbcode so it can easily be understood.

Is this for an assignment or a test?