-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClasses
More file actions
36 lines (31 loc) · 957 Bytes
/
Classes
File metadata and controls
36 lines (31 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// class User {
// constructor(username, email, password){
// this.username = username;
// this.email = email;
// this.password = password;
// }
// encryptPassword(){
// return `${this.password}abc`
// }
// changeUsername(){
// return `${this.username.toUpperCase()}`
// }
// }
// const Ritochit = new User("Ritochit", "ghosh@123.com", "123");
// console.log(Ritochit.encryptPassword());
// console.log(Ritochit.changeUsername());
//Behind the Scene
function User(username, email, password){
this.username = username;
this.email = email;
this.password = password;
}
User.prototype.encryptPassword = function(){
return `${this.password}abc`
}
User.prototype.changeUsername = function(){
return `${this.username.toUpperCase()}`
}
const Rivu = new User("Ritochit", "ghosh@123.com", "123");
console.log(Rivu.encryptPassword());
console.log(Rivu.changeUsername());