---
title: "Comment by Bob Jones on \"ES6 - Higher-Order Functions\" | Hashnode"
description: "Hi Skay , thanks for the article. There is an incorrect comment in your code: //Higher order function - takes &#x27;func&#x27; as an argument &amp; returns a &#"
url: "https://hashnode.com/posts/es6-higher-order-functions/5f86951976870f43aa09d304/comment/5f8872136eb39417ce5e43c6"
---

[Discussion](https://hashnode.com/posts/es6-higher-order-functions/5f86951976870f43aa09d304)

Comment [ES6 - Higher-Order Functions](https://hashnode.com/posts/es6-higher-order-functions/5f86951976870f43aa09d304)

[Bob Jones](https://hashnode.com/@crazy4groovy)

[Oct 15, 2020](https://hashnode.com/posts/es6-higher-order-functions/5f86951976870f43aa09d304/comment/5f8872136eb39417ce5e43c6)

Hi [Skay](https://hashnode.com/@skay), thanks for the article.

There is an incorrect comment in your code:

```
//Higher order function - takes 'func' as an argument & returns a 'func' for execution
const higherOrderFunction = function(func, a, b) {
    return func(a, b);
}
```

This function is not actually returning a function, but rather the result of the callback function, which is data.

A more concise example might be:

```
const sum = function(a, b) {
    return a + b;
}
//Higher order function - takes 'func' as an argument & returns a 'func' for execution
const higherOrderFunction = (func) => (a, b) => {
    return func(a, b);
}
const sumFor = higherOrderFunction(sum);
console.log(sumFor(2,3));
```

Here, `higherOrderFunction` takes `func` and returns a function, which then takes `a,b` and return data.

Cheers!

[Skay](https://hashnode.com/@skay)

[Oct 15, 2020](https://hashnode.com/posts/es6-higher-order-functions/5f86951976870f43aa09d304/comment/5f8872136eb39417ce5e43c6#reply-5f887bbf6eb39417ce5e4455)

[Bob Jones](https://hashnode.com/@crazy4groovy) - Thank you for catching this! While I had intended to convey what you had indicated it, I did not want to use arrow functions and it got a little messy.

I have updated the main section of code, with your code snippet and included additional comments on what the higher-order function returns.

Once again, thank you for catching this. Really appreciate it!!
