Nice article! I found a couple of mistakes, though.
Regarding HOF: In the first code snippet, the printMsg function is missing an argument. It could be called like so:
printMsg
//... printMsg(isEven, 2);
Regarding callbacks: The code is not correct. It should be:
let numbers = [1, 2, 4, 7, 3, 5, 6]; function isOddNumber(number) { return number % 2 !== 0; } const oddNumbers = numbers.filter(isOddNumber); console.log(oddNumbers); // [1, 7, 3, 5]
Regarding closures and exceptions: The definition is on point, awesome! But with the exception, the code has a mistake: the new Function statement is missing an argument:
new Function
//... let func = new Function('value', 'alert(value)'); //...
In this way, the actual result is undefined.
undefined
I really appreciate this, Damian. Thank you very much for correcting my mistakes and taking the time to write this. 😊
I have corrected the code snippets.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article! I found a couple of mistakes, though.
Regarding HOF:
In the first code snippet, the
printMsg
function is missing an argument. It could be called like so:Regarding callbacks:
The code is not correct. It should be:
Regarding closures and exceptions:
The definition is on point, awesome! But with the exception, the code has a mistake: the
new Function
statement is missing an argument:In this way, the actual result is
undefined
.I really appreciate this, Damian. Thank you very much for correcting my mistakes and taking the time to write this. 😊
I have corrected the code snippets.