Make Object Properties Private Please Help

Tell us what’s happening:
Not sure what I’m missing. Been working on this problem for a couple of days now.

Your code so far

var Car = function() {
  // this is a private variable
  var speed = 10;

  // these are public methods
  this.accelerate = function(change) {
    speed += change;
  };

  this.decelerate = function() {
    speed -= 5;
  };

  this.getSpeed = function() {
    return speed;
  };
};

var Bike = function() {

  // Only change code below this line.
  var gear;
  
  this.getGear = function(change) {
    speed = 4;
  };
  
  this.setGear = function(change) {
    speed = 4;
    
  myBike.setGear(4);
    myBike.getGear();
  };
};

var myCar = new Car();

var myBike = new Bike();

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10176.68.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.144 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/make-object-properties-private

Here’s what you’ve got right:

  • You have the private property gear
  • You have an object method called getGear
  • You have an object method called setGear

Here’s what you have wrong:

  • Your method getGear does not return the value of gear
  • Your method setGear does not set the value of gear to anything but the number 4
  • You are calling myBike.setGear and myBike.getGear in your object method for some reason

Read the info on the left carefully, especially the instructions.