Skip to content

Commit 1bbbc93

Browse files
committed
working on class
1 parent 93e5e64 commit 1bbbc93

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎src/class.js‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
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+
17+
comparePasswords () {
18+
if (options.password = this.password)
19+
return true;
20+
}
21+
22+
}
23+
const checkPasswd = new User({email:'adfaris@gmail.com', password:'123456789'});
24+
console.log(checkPasswd);
25+
checkPasswd.comparePasswords('12345600');
1126

1227
// Part 2
1328
// Create a class called `Animal` and a class called `Cat` using ES6 classes.
@@ -21,6 +36,23 @@
2136

2237
// code here
2338

39+
class Animal {
40+
constructor(obj){
41+
this.type = obj.type;
42+
this.name = obj.name;
43+
this.sound = obj.sound;
44+
}
45+
46+
differentSound(){
47+
return this.sound;
48+
}
49+
}
50+
51+
class Cat.Animal{
52+
53+
}
54+
55+
2456
/* eslint-disable no-undef */
2557

2658
module.exports = {

0 commit comments

Comments
 (0)