There following is a custom class method in my index.js:
function getCurrentTaskGuide() { if (this.attributes['currentTaskGuide'] == undefined) { this.attributes['currentTaskGuide'] = 1; } else if (!this.attributes['currentTaskGuide']) { this.attributes['currentTaskGuide'] = 1; } return this.attributes['currentTaskGuide']; }
Within the same file, in my intent blocks, if I want to call the method, the following call works as desired:
var currentTaskGuide = getCurrentTaskGuide.call(this);
However, the following always returns "undefined":
var currentTaskGuide = getCurrentTaskGuide();
I'm still learning Node.js but can someone explain why I have to use getCurrentTaskGuide.call(this) over getCurrentTaskGuide() ?