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
27 changes: 27 additions & 0 deletions src/class.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// DONE
// Part 1
// Create a class called User using the ES6 class keyword.
// The constructor of the class should have a parameter called `options`.
Expand All @@ -8,6 +9,15 @@
// 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(potentialPassword) {
return this.password === potentialPassword;
}
}

// Part 2
// Create a class called `Animal` and a class called `Cat` using ES6 classes.
Expand All @@ -20,7 +30,24 @@
// property set on the Cat instance.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the directions weren't clear on this but it should actually be
this.age = this.age + 1
so as to 'age' the Animal

}

class Cat extends Animal {
constructor(options) {
super(options);
this.name = options.name;
}
meow() {
return `${this.name} meowed!`;
}
}
/* eslint-disable no-undef */

module.exports = {
Expand Down
Loading