Calling methods within same JavaScript class [Prototype]
- by eldeejay
I've created a class in Javscript using the prototype Class.Create complete with the initialize function and a few other functions. However, in one of my functions I want to reference another function in the same class, but cannot seem to get the syntax correct.
e.g.
var sampleClass = Class.create({
initialize: function(){
//do the init work here
},
functionA: function(){
//do some more stuff here
}
functionB: function(){
//Do some stuff
functionA()
}
}
I've tried calling functionA() , this.functionA() but nothing works I just get errors. I know how to call the functions externally when the class has been instantiated, but not reference a function from within the class itself.
Thanks