Created
July 22, 2019 12:30
-
-
Save ppraksa/7c363bd4b5b5bed66eea4f97fd06226a to your computer and use it in GitHub Desktop.
simple const implementation
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
function Constans(arg, value) { | |
return Object.defineProperty(this, arg, { | |
value: value, | |
writable: false | |
}); | |
} | |
Constans('test', 2); | |
test; //2 | |
test = 3; | |
test; // still 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment