Tell us what’s happening:
I inserted the code following the guide, but I don’t understand how by creating a variable within the constructor function works on making the public property private.
**Your code so far**
function Bird() {
let weight = 15;
this.getWeight= function(){
return weight
};
}
let ducky = new Bird();
ducky.getWeight();
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Challenge: Use Closure to Protect Properties Within an Object from Being Modified Externally