|
|
|
|
|
by kevincennis
3271 days ago
|
|
I believe that one of the main reasons not to do this is that adding anything to `Object.prototype` means that now everything inherits that new method. So you have weird things like `'foo'.map()`, `( 42 ).map()`, `new WeakMap().map()`, `false.map()`, etc. |
|
'foo' is a string and can be iterated over.
42 is a number that can be provided to a function. Not sure about this one tbh. Could be useful for passing a number to a function if-and-only-if the number is valid (not NAN)
WeakMap(), I don't know what it is but I assume it's a map that can be iterated over.
mapping 'false' would fit well the Maybe monad.