File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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.
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
You can’t perform that action at this time.
0 commit comments