getify / Functional-Light-JS

Pragmatic, balanced FP in JavaScript. @FLJSBook on twitter.
http://FLJSBook.com
Other
16.6k stars 1.96k forks source link

Missing function keyword in code snippet. #185

Closed mutalis closed 5 years ago

mutalis commented 5 years ago

Missing function keyword in snippet code at: https://github.com/getify/Functional-Light-JS/blob/master/manuscript/ch7.md/#behavior-too

function person(name,age) {
    return happyBirthday(){
        age++;
        console.log(
            `Happy ${age}th Birthday, ${name}!`
        );
    }
}

It should be:

function person(name,age) {
    return function happyBirthday(){
        age++;
        console.log(
            `Happy ${age}th Birthday, ${name}!`
        );
    }
}
protoEvangelion commented 5 years ago

There is a PR open for this: https://github.com/getify/Functional-Light-JS/pull/158

getify commented 5 years ago

dupe.