Getter and Setter Methods in JavaScript

const robot = {
  _model: '1E78V2',
  _energyLevel: 100,
  _numOfSensors: 15,
setEnergyLevel(num){
this._energyLevel = num;
}
}

Can’t i simply make a simple function to set a variable? instead of using the set keyword as we are doing in JAVA.
And also if this is my set method

set numOfSensors(num){
   if (typeof(num)==='number' && num >=0)
     this._numOfSensors = num;
  
  else
  	console.log('Pass in a number that is greater than or equal to 0');
  }

why do i have to set it like this

robot.numOfSensors=100;

isn’t that a simple method so i should be able to say robot.numOfSensors(100); it’s getting really confusing for me if anybody could explain this to me i would be glad;