Var is broken in js because it does not obey sensible semantics
for(var i....
does what you think it does. In every language except javascript it would declare i only inside the loop. In js it declares i in whatever function scope the loop is inside. A = function(){
console.log(this);
}
A.prototype.q = function(b){
this.h = b;
}
imp = new A();
setTimeout(100, imp.q)
//later, in a response to a user event
console.log(imp.h)
prints undefined. Why? because in Javascript the value of this changes. There is literally no other language where this is dynamically (as opposed to lexically) scoped.Don't even get me started on the lack of ints, the lack of static types (which means your IDEs suck).
As for why node decieded to go with js? No idea, though it is one of the things I hate most about node. Haskell would have been a better choice, as would Lua.