Make Object Properties Private help

Make Object Properties Private help


Hello, if someone could help me with this task. Dont know what I’m missing…

var Bike = function() {

var gear = 0;

this.setGear = function (i) {
gear += i;

this.getGear = function() {
return gear;



In your setGear method you’re adding i to the gear total each time… I think this would mean that your gear numbers will keep incrementing. What you want is for ‘gear = i’.



gear += i; this is same as gear = gear + i is that the desired effect ?


‘gear = i’ solved the problem…