Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 148 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/LambdaSchool/javascript-ii.git"
},
},
"devDependencies": {
"babel-jest": "^19.0.0",
"eslint": "^3.17.1",
Expand Down
36 changes: 33 additions & 3 deletions src/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@
// Return true if the potential password matches the `password` property. Otherwise return false.

// code here

class User {
constructor(options) {
this.email = options.email;
this.password = options.password;
}
comparePasswords(password) {
if (this.password === password) {
return true;
} return false;
}
}
// Part 2
// Create a class called `Animal` and a class called `Cat` using ES6 classes.
// `Cat` should extend the `Animal` class.
// `Cat` should extend the `Animal` class.
// Animal and Cat should both have a parameter called `options` in their constructors.
// Animal should have the property `age` that's set in the constructor and the method
// `growOlder` that returns the age after incrementing it.
Expand All @@ -20,9 +30,29 @@
// property set on the Cat instance.

// code here
class Animal {
constructor(options) {
this.age = options.age;
}
growOlder() {
this.age = this.age + 1;
return this.age;
}
}

/* eslint-disable no-undef */

class Cat extends Animal {
constructor(options) {
super(options, options);
this.name = options.name;
}
meow() {
return `${this.name} meowed!`;
}
}


/* eslint-disable no-undef */
module.exports = {
User,
Cat,
Expand Down
Loading