Well for a more realistic scenario, imagine you've got an object like {key: {value: "regexstring"}} and want to pass the value to regex but forget that you have to pass a value from the key and just do like object.key instead of object.key.value. The fact that JS just kind of shrugs and steams onward without any issue means that now you've got the above issue at your hands any you don't even know it. Makes for some absolutely fantastic debugging when your regex acts in ways you don't expect.
Especially when regex by itself is already a concept where a lot of people struggle trying to make sense of it. So the fact that it doesn't work right would 100% be blamed on the regex being bad first and not the key fetching being broken.
Totally skill issue. toString is not a JS exclusive thing. If you code wrong, it works wrong, well, that also happens in C#, in C++, in Java, in <insert the name of whatever>.
By your view it sounds that all languages solve your mistakes in build time.
View all comments
Show parent comment
0
u/Spork_the_dork Mar 20 '24
Well for a more realistic scenario, imagine you've got an object like
{key: {value: "regexstring"}}and want to pass the value to regex but forget that you have to pass a value from the key and just do likeobject.keyinstead ofobject.key.value. The fact that JS just kind of shrugs and steams onward without any issue means that now you've got the above issue at your hands any you don't even know it. Makes for some absolutely fantastic debugging when your regex acts in ways you don't expect.Especially when regex by itself is already a concept where a lot of people struggle trying to make sense of it. So the fact that it doesn't work right would 100% be blamed on the regex being bad first and not the key fetching being broken.