Comment Re:Javascript is a disaster (Score 1) 305
No scope to speak of
well, it's not true really. In the following example x will have global scope and y will be local to its function:
x=2;
function test() {
y = x + 3;
}
--
The declaration of the variable 'y' in the example is missing its keyword 'var' and will unintentionally create a globally scoped variable.
Should be:
var x = 2;
function test(){
var y;
y = x + 3;
}
console.log(x);
console.log(typeof y);
- well, there is the keyword "inherits" and it does allow an object to be extended and you can use the 'prototype' to have multiple inheritance.
The prototype inheritance pattern doesn't allow for true multiple inheritance (like what C++ has). However, you can fake it by munging functions from multiple classes into your class' prototype effectively providing the functionality of multiple inheritance in simple cases.