Skip to content

Commit 4b192bb

Browse files
committed
class all passing
1 parent 0513e79 commit 4b192bb

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

src/class.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
// for a potential password that will be compared to the `password` property.
88
// Return true if the potential password matches the `password` property. Otherwise return false.
99

10-
// code here
10+
class User {
11+
constructor(options) {
12+
this.email = options.email;
13+
this.password = options.password;
14+
}
15+
comparePasswords(potentialPassword) {
16+
return (potentialPassword === this.password);
17+
}
18+
}
1119

1220
// Part 2
1321
// Create a class called `Animal` and a class called `Cat` using ES6 classes.
@@ -19,7 +27,24 @@
1927
// `meow` that should return the string `<name> meowed!` where `<name>` is the `name`
2028
// property set on the Cat instance.
2129

22-
// code here
30+
class Animal {
31+
constructor(options) {
32+
this.age = options.age;
33+
}
34+
growOlder() {
35+
return this.age += 1;
36+
}
37+
}
38+
39+
class Cat extends Animal {
40+
constructor(options) {
41+
super(options);
42+
this.name = options.name;
43+
}
44+
meow() {
45+
return `${this.name} meowed!`;
46+
}
47+
}
2348

2449
/* eslint-disable no-undef */
2550

0 commit comments

Comments
 (0)