//sample solution
var MathObject = {
val: 42,
setVal: function(newVal){
this.val = newVal;
},
getVal: function(){
return this.val;
},
getSqrVal: function(){
this.val = this.val * this.val;
return this.val;
},
getValplusplus: function(){
this.val++;
return this.val;
},
getValplusN: function(N){
this.val+=N;
return this.val;
}
};
//test
console.log(MathObject.getValplusN(8));
No comments:
Post a Comment