2 ms·
Granted, but that's an incidental problem, not one arising from JS being a bad language. Also, I highly doubt there is much advertising code that changes the va
by benaiah 13y ago
Granted, but that's an incidental problem, not one arising from JS being a bad language. Also, I highly doubt there is much advertising code that changes the value of "undefined" - certainly not any I've encountered.
This really boils down to "my code won't act the same way if I give unfettered access to my environment to unvetted code" which is true in almost any situation. If you're having problems because "undefined" is being redefined, you have bigger and more fundamental problems. There are a lot of bad things about JS, but this is not one of them - its overly nitpicky and completely unfair. This same capability (of being able to redefine almost anything) is lauded as part of Ruby, but when it could theoretically cause any easy-to-avoid problem in JS, it's just more proof that JS is a shitty language.
Sorry if I'm coming across as combative - I don't mean to. I just think this whole snide criticism of JS for every little thing is silly and unhelpful, and has more to do with a superiority complex than actual technical issues.
- gwright 13y agoIn general you are correct, redefinition in Ruby can be abused, but it isn't so easy to abuse 'nil' in Ruby as it is to abuse 'undefined' in Javascript. In Ruby, nil, is a keyword so you can't assign to it nor can you use it as a method parameter.