I like the old non-class
way of declaring classes in Javascript, because I haven't quite figured out how to use this
properly in classes.
function _foo(){
this.bar=10;
}
var foo = new _foo();
But I also want to be able to let _foo
extend another class, say EventEmitter
. How would I go about doing this?
I've tried the following:
function _foo(){
EventEmitter.call(this);
}
var foo=new _foo();
foo.on(); //throws error: foo.on is not a function - even though EventEmitter.on is a function.
Thanks