Object Oriented Programming - Use Closure to Protect Properties Within an Object from Being Modified Externally

Tell us what’s happening:
Code is not accepted when getWeight function accepts a parameter.

Your code so far

function Bird() {
  let weight = 15;

  this.getWeight = _ => weight;
}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0

Challenge: Object Oriented Programming - Use Closure to Protect Properties Within an Object from Being Modified Externally

Link to the challenge:

You shouldn’t declare a parameter that’s not used.

As said, there is no point in declaring a parameter that isn’t used.

Also, getters usually just return data, as such there is really no point in giving a getter parameters.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.