Last active
September 26, 2020 20:36
-
-
Save wentout/1fc4f8cedaf127c0499b065ac3e8320e to your computer and use it in GitHub Desktop.
example of what immutable number is indeed
This file contains hidden or 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 a = new Number(100); | |
| a.subtract = function (b) { | |
| return this.valueOf() - b; | |
| }; | |
| console.log(a.subtract(10)); // 90 | |
| console.log(a - 10); // 90 | |
| console.log(a - 10); // 90 | |
| console.log(a - 10); // guess |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment