---
title: "Discussion on \"What exactly is a function in JavaScript?\" | Hashnode"
description: "Discussion on \"What exactly is a function in JavaScript?\". Introduction\n\nIt took me six months to fully understand the concept of functions in JavaScript. You read that right.\n\nWhen I just started coding in javascript, I wrote a lot of shitty code as I was new to the programming world, I had a lot of documen..."
url: "https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What exactly is a function in JavaScript?](https://blog.codellyson.com/what-exactly-is-a-function-in-javascript?utm_source=hashnode&utm_medium=feed)

Introduction It took me six months to fully understand the concept of functions in JavaScript. You read that right. When I just started coding in javascript, I wrote a lot of shitty code as I was new to the programming world, I had a lot of documen...

Sep 29, 2020 · 5 min read · blog.codellyson.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)

## Written by

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

@dellyson · Abuja, Nigeria

  
[View profile](https://hashnode.com/@dellyson)

Web Developer

## Responses 3

Markdown supported · ⌘↵ to post

[Michael Zwierzanski](https://hashnode.com/@MichaelZ)

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

Thanks for writing this Isiaka. It's rather helpful, conceptually speaking.

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

[Oct 10, 2020](https://hashnode.com/posts/what-exactly-is-a-function-in-javascript/5f73c7b6f955ec0a130f6bc9/comment/5f81aa527762251b305d90ef#reply-5f81b50a7762251b305d914e)

Glad to know it's been helpful to you

[Jen Openshaw](https://hashnode.com/@jlopenshaw)

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

Great post. I love the idea of cows and fences - I have a feeling I'm going to be picturing those cows in their fence every time I write a function now haha!

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

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

Thanks, that's how I have been picturing functions for a while now

[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)
