Ask coding questions

← Back to all posts
JS Assignment 13: Intro to Classes in Javascript
ReinierB (15)

I have tried so many version of getting the right answer but is not passing! I think the questions tend to be tricky that looks so simple or maybe they are not so well put. I am having an error.
It is ecpeted to be true " false. can somoen help here with some hints?
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() {
this.password === this.checkPassword;
return true;
}
}

Commentshotnewtop
KevinFisher (0)

I'm having the same problem, and I cant get this one done!

ReinierB (15)

@KevinFisher i kept going, i finished the rest, but i couldn't finish this one! did you solve it?

KevinFisher (0)

@ReinierB
nope, I have been looking. I started reading my javascript book, so I'll let you know what I find out. I have also sent out a couple requests for help.

KevinFisher (0)

@ReinierB
would you happen to know this one
// Function Two: Will be called 'calculator'.
// This function will take three parameters,
// First will be a callback function,
// Second and Third will be numbers.
// This function will return the two numbers passed into the callback function.
function calculator(multipy, num1, num2){
// NOTE: You can use the multiply function to test the calculator function, but understand that
// other callback functions will be passed into it as a test.
function multiply(){
return num1, num2;
}
}

ReinierB (15)

@KevinFisher yeah! when they say multiply
function multyply(num1, num2) {
return num1 * num2;
}

you are missing the parameters and multiply

ReinierB (15)

@KevinFisher what exserice is this one? what number?

KevinFisher (0)

@ReinierB
15, and I did that, I forgot to update it.
function multiply() {
return num1 * num2
}
}
didnt pass... those are my only 2 left, I'm trying to study for the challenge. I may take it over the weekend.

janetsomehow1 (2)

@KevinFisher hi there. Im stucked in assignment 11. This is what i did but the code isnt running
function exerciseOne(){
// Exercise One: In this exercise you will create a variable called 'aboutMe'
// This variable should be assigned a new object
// In this object create three key:value pairs
// The keys should be: 'name', 'city', 'favoriteAnimal'
// The values should be strings associated with the keys.
// return the variable 'aboutMe'
var aboutMe = {
name:"Janet",
city:"Uyo",
favoriteAnimal:Dog,
};
return aboutMe;
function exerciseTwo(animal){
// Exercise Two: In this exercise you will be given an object called 'animal'
// Create a new variable called 'animalName'
// Accessing the animal object, assign the 'animalName' variable to the 'latinName' key on the object.
// return the animalName variable.
let animalName = {
animalName: 'latinName',
};
animalName.latinName;
return animalName;
}
function exerciseThree(userObject){
// Exercise Three: In this exercise you will be given an object called 'userObject'
// The phonne number for this user is incorrect!
// reassign the 'phoneNumber' key to the value: '(951)867-5309'
// return the userObject
userObject.phoneNumber = '(951)867-5309';
};

MIAlien (0)

@janetsomehow1 Hey, I completed this assignment as well. It was tricky at first.

let aboutMe = {

name:'Janet',

city:'Uyo',

favoriteAnimal: 'Dog',
}
return aboutMe;
}
MIAlien (0)

@janetsomehow1 userObject.phoneNumber = '(951)867-5309';
} is close but you forgot to return the userObject.

userObject.phoneNumber = '(951)867-5309';
return userObject;
}

MIAlien (0)

@KevinFisher Hey, not sure if you got it by now. However, for JS Assignment 15: Intro to Callbacks function 2:

function calculator(callback, num1, num2){
return callback(num1, num2);
}