---
title: "Discussion on \"Functional Programming with JavaScript\" | Hashnode"
description: "Discussion on \"Functional Programming with JavaScript\". For all the folks out there starting their programming journey as well as those who have been programming for quite a some time, you all might have come across the term functional programming at some point or you definitely will. \nIn this blog I'll t..."
url: "https://hashnode.com/posts/functional-programming-with-javascript/607486a085f3a21e3926c0b4"
---

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

Discussion

# [Functional Programming with JavaScript](https://saurabhkamboj.hashnode.dev/functional-programming-with-javascript?utm_source=hashnode&utm_medium=feed)

For all the folks out there starting their programming journey as well as those who have been programming for quite a some time, you all might have come across the term functional programming at some point or you definitely will. In this blog I'll t...

Apr 12, 2021 · 11 min read · saurabhkamboj.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)
-   [#introduction](https://hashnode.com/tag/introduction)
-   [#interview](https://hashnode.com/tag/interview)

## Written by

[Saurabh Kamboj](https://hashnode.com/@saurabhkamboj)

@saurabhkamboj · India

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

Software Engineer

Software Engineer at Cars24

## Responses 1

Markdown supported · ⌘↵ to post

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

[Apr 14, 2021](https://hashnode.com/posts/functional-programming-with-javascript/607486a085f3a21e3926c0b4/comment/60772ec9a3407a32d7042148)

Thanks for sharing this article, I've learnt new things about the paradigm.

Quick question, is it compulsory that a function must take in an input before it's called a pure function, all the time?

Or can a function which doesn't have an input and returns an output with no dealing with side effects be called functional programming?

[Saurabh Kamboj](https://hashnode.com/@saurabhkamboj)

[Apr 15, 2021](https://hashnode.com/posts/functional-programming-with-javascript/607486a085f3a21e3926c0b4/comment/60772ec9a3407a32d7042148#reply-60781db54155da32fc83c139)

I'm really glad you liked the article.

So to answer your question, as long as your function produces the same output even without an input value and that too without accessing anything from the outside view , it is a pure function.

```
const num =7 ;
const sentence = () => {return 'It is a good day' ; }
```

Here sentence function doesn't have an input value, but it'll produce the same result always. Hence a pure function.

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

[Apr 15, 2021](https://hashnode.com/posts/functional-programming-with-javascript/607486a085f3a21e3926c0b4/comment/60772ec9a3407a32d7042148#reply-607828f44155da32fc83c271)

Okay thanks for the feedback [Saurabh Kamboj](https://hashnode.com/@saurabhkamboj)
