const bicycle = {
gear: 2,
setGear(newGear) {
“use strict”;
this.gear = newGear;
}
};
// change code above this line
bicycle.setGear(3);
console.log(bicycle.gear);
what is the use of ( this ) keyword in the code can anybody explain .
const bicycle = {
gear: 2,
setGear(newGear) {
“use strict”;
this.gear = newGear;
}
};
// change code above this line
bicycle.setGear(3);
console.log(bicycle.gear);
what is the use of ( this ) keyword in the code can anybody explain .
Checkout the following challenge for an explanation regarding the this
keyword.