Trying to get my head around javascript OOP, why is this causing the test method to print the entire function definition as if it was a string?
var Myclass = function Myclass(){
this.connection = make_ajax();
this.hasConnection = function(){return this.connection};
this.test = function(){
console.log(this.hasConnection);
}
}
var x = new Myclass();
x.test();
Result:
log: function(){return this.connection}
make_ajax?var Myclass = function Myclass()should either byvar Myclass = function()orfunction Myclass()}in the end.