VIDEO 45 IN JS

PHOTO EMBED

Mon Jan 13 2025 18:14:37 GMT+0000 (Coordinated Universal Time)

Saved by @E23CSEU1151

//////////////// classes in javascript //////////////////
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 chai = new user ("chai ", "chai@gmail.com ", "123 ") 

console.log(chai.encryptPassword() );
console.log(chai.changeusername() );



////////////// behind the scene 

function User1(username , email , password ){
    this.username = username ;
    this.email = email ;
    this.password = password  ;
}
User1.prototype.encryptPassword = function() {
    return `${this.password} abc`
}
User1.prototype.changeusername = function() {
    return `${this.username.toUpperCase()}abc`
}
const tea = new User1 ("tea" , " tea@gmail" , "123" )


console.log(tea.encryptPassword() );
console.log(tea.changeusername() );
content_copyCOPY