by codexon · 16y ago · 0 comments
- Global variables by default, which means you will have "var" sprinkled everywhere.
- Brain-dead binding.
function Constructor() {
this.foo = 'bar';
var that = this;
window.setTimeout(function() {
alert(that.foo);
}, 1);
}
- You can call a function with less arguments than specified, meaning you potentially have to make sure each argument is not "undefined" .- Somehow JS isn't weakly typed when it comes to switch statements.
a = 5;
b = '5';
if( a == b )
alert("Equal");
switch (a) {
case b:
alert("This never shows");
}
I am fairly certain that JS popularity is mostly in part due to its monopoly on the web. I'm sure there are more experienced JS users who can point out more flaws.So no, I've never encountered such problems.
Nowhere did I complain about needing to declare things before using it. Having variables be global by default is really poor design.
And about silly equalities, it will inevitably happen once your programs get bigger, and you become frustrated with a bug that has been suppressed through multiple function calls because Brendon Eich thought weak typing was a good idea.