4 ms·
Only thing useful I can come up is monkey patching without changing the function signature. E.g. smuggling additional data to a function which expects a string
by Ciantic 6y ago
Only thing useful I can come up is monkey patching without changing the function signature. E.g. smuggling additional data to a function which expects a string like thing.
But I think the whole `new String` is problematic, because it breaks the strict comparison:
let a = "Foo";
let b = new String("Foo");
a === "Foo"
true
b === "Foo"
false
- mgerullis 6y ago> Only thing useful I can come up is monkey patching without changing the function signature. E.g. smuggling additional data to a function which expects a string like thing. Yeah this sounds terrifying to me, if I were to debug something like this. Also the fact they identify as objects: typeof new String("Foo") === 'object'; Case closed, I will never use it :D