Skip to content

Commit 43177ec

Browse files
committed
Completed class.js assignment
1 parent da10689 commit 43177ec

3 files changed

Lines changed: 177 additions & 18 deletions

File tree

‎package-lock.json‎

Lines changed: 148 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"repository": {
1313
"type": "git",
1414
"url": "git+https://github.com/LambdaSchool/javascript-ii.git"
15-
},
15+
},
1616
"devDependencies": {
1717
"babel-jest": "^19.0.0",
1818
"eslint": "^3.17.1",

‎src/class.js‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
// Return true if the potential password matches the `password` property. Otherwise return false.
99

1010
// code here
11+
class User {
12+
constructor(options) {
13+
this.email = options.email;
14+
this.password = options.password;
15+
}
16+
comparePasswords(passwordToCheck) {
17+
return this.password === passwordToCheck;
18+
}
19+
}
1120

1221
// Part 2
1322
// Create a class called `Animal` and a class called `Cat` using ES6 classes.
@@ -21,6 +30,25 @@
2130

2231
// code here
2332

33+
class Animal {
34+
constructor(options) {
35+
this.age = options.age;
36+
}
37+
growOlder() {
38+
return ++this.age;
39+
}
40+
}
41+
42+
class Cat extends Animal {
43+
constructor(options) {
44+
super(options);
45+
this.name = options.name;
46+
}
47+
meow() {
48+
return `${this.name} meowed!`;
49+
}
50+
}
51+
2452
/* eslint-disable no-undef */
2553

2654
module.exports = {

0 commit comments

Comments
 (0)