---
title: "Comment by Favourite Jome on \"What exactly is a function in JavaScript?\" | Hashnode"
description: "Awesome explanation, but I think you made a mistake here : the code above doubles the number in the array and logs it in the console. . . Here is how variable s"
url: "https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9/comment/5f73cf32f955ec0a130f6bf8"
---

[Discussion](https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9)

Comment [What exactly is a function in JavaScript?](https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9)

[Favourite Jome](https://hashnode.com/@Favourite)

[Sep 30, 2020](https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9/comment/5f73cf32f955ec0a130f6bf8)

Awesome explanation, but I think you made a mistake here :

> the code above doubles the number in the array and logs it in the console. . .

Here is how variable `sum` will be logged

```
 function doubleThaNumbers(){
    const digits = [1,2,3,4,5,6];
    const sum = digits.map(function(n){
                  return n*2
                })
    console.log(sum)
 }

doubleThaNumbers()
```

[Isiaka Lukman](https://hashnode.com/@dellyson)

[Sep 30, 2020](https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9/comment/5f73cf32f955ec0a130f6bf8#reply-5f7485069e97481f1076f97c)

Thanks for pointing out the error, I really appreciate.

[Favourite Jome](https://hashnode.com/@Favourite)

[Sep 30, 2020](https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9/comment/5f73cf32f955ec0a130f6bf8#reply-5f749f9f9e97481f1076fb4d)

You're welcome[Isiaka Lukman Bamidele](https://hashnode.com/@dellyson)
