Possible error in Lesson 10: Javascript VII (Closure) class notes
Opened this issue · 0 comments
aellis77 commented
In the lesson 10: Javascript VII (Closure) class notes for the mini web boot camp we have the following: Here is the context :
This also applies to the function's parameters:
function makeMultiplier(x) {
return function(y) {
return x * y;
}
}
const multiplyByFive = makeMultiplier(5);
const product1 = multiplyByFive(10);
const multiplyByTwo = makeMultiplier(5);
const product2 = multiplyByTwo(7);
console.log(product1); // logs 50
console.log(product2); // logs 14
For product 2, the const multiplyByTwo = makeMultiplier(5); This implies that we will be multiplying by 5. This doesn't match the context of the constant name, nor does it create a result of product2 = 14 = 2*7.