I’m using the Prototype JS library to make classes.
var myClass = Class.create({
initialize: function() {
this.myValue = 5;
},
returnHello: function() {
return 'hello';
},
explainYourself: function() {
return this.returnHello() + ", my value is: " + this.myValue;
}
});
In explainYourself(), I tried to call returnHello() and I got an error saying this.returnHello() is not a function. What is the correct syntax?
And how do you make field and methods private/public/protected in Prototype?