Skip to content

Commit f41e6c8

Browse files
Add files via upload
1 parent 72a9055 commit f41e6c8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

10_Classes_and_OOP/getter_setter.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class User {
2+
constructor(email, password){
3+
this.email = email;
4+
this.password = password
5+
}
6+
7+
get email(){
8+
return this._email.toUpperCase()
9+
}
10+
set email(value){
11+
this._email = value
12+
}
13+
14+
get password(){
15+
return `${this._password}hitesh`
16+
}
17+
18+
set password(value){
19+
this._password = value
20+
}
21+
}
22+
23+
const hitesh = new User("[email protected]", "abc")
24+
console.log(hitesh.email);

0 commit comments

Comments
 (0)