Tag

class

c

Implementing a class in JavaScript

let’s implement a class called FeedDog in JavaScript, that has an object inside which changes when a function is called!
var FeedDog=function(treat){var obj={treatSize:treat};
obj.increaseTreat=function(){
obj.treatSize++;
};
return obj;
}

Latest from Sarabpreet