I'm having trouble calling a method from within another method of the same object.
Any help on what I may be missing, or what to look for, would be greatly appreciated.
var IceCream = function (flavor) {
this.tub = 100;
this.flavor = flavor;
};
IceCream.prototype = {
scoop : function () {
this.updateInventory; alert("scooping");
},
updateInventory : function () {
this.tub --;
alert(this.tub);
}
};
var vanilla = new IceCream("vanilla");
vanilla.scoop();
asked Jan 11, 2016 at 4:24
Matthew J Mammola
711 silver badge6 bronze badges
1 Answer 1
answered Jan 11, 2016 at 4:27
Anik Islam Abhi
25.4k8 gold badges61 silver badges82 bronze badges
Sign up to request clarification or add additional context in comments.
3 Comments
Kevin Simple
you just 30 seconds fater than me, sigh
Anik Islam Abhi
glad to know :P i am the rabbit here :P @KevinSimple
Matthew J Mammola
ah damn, what an easy one! Thanks a lot @Anik
lang-js