-
-
Save ArfatSalman/07f8663adfd78ddc4af8ebea152cdbae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
get name() { | |
return this._name.toUpperCase(); | |
}, | |
set name(value) { | |
this._name = value; | |
}, | |
get id() { | |
return this._id.toString(2); // Returns binary of a number | |
}, | |
set id(value) { | |
this._id = value; | |
} | |
} | |
obj.name = 'Arfat'; | |
obj.name; | |
// => 'ARFAT' | |
obj.id = 5; | |
obj.id; | |
// => '101 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment