Skip to content

Possible error in Lesson 10: Javascript VII (Closure) class notes #1591

@aellis77

Description

@aellis77

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions