Within my Angular.js
module, I have defined an object like this:
$scope.Stack = function () {
this.top = null;
this.size = 0;
};
However, when I try to use the push
method of this object, I encounter an error stating undefined
:
$scope.Stack.push = function (data) {
return this.size;
};
Can anyone explain why this is happening?