---
title: "Discussion on \"Pure vs Impure Functions\" | Hashnode"
description: "Discussion on \"Pure vs Impure Functions\". Understand pure and impure functions with side effects"
url: "https://hashnode.com/posts/pure-vs-impure-functions/62833c6f504da209d8557134"
---

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

Discussion

# [Pure vs Impure Functions](https://suprabhasupi.hashnode.dev/pure-vs-impure-functions?utm_source=hashnode&utm_medium=feed)

Understand pure and impure functions with side effects

May 17, 2022 · 3 min read · suprabhasupi.hashnode.dev  
Read the article

-   [#thw-web-apps](https://hashnode.com/tag/thw-web-apps)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Suprabha Supi](https://hashnode.com/@suprabhasupi)

@suprabhasupi · Bengaluru, India

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

🔥 New JS, CSS, HTML articles every week 🔥

I am Senior Frontend Engineer and post daily tips about Web Dev My goal is to encourage more people to get into tech.

## Responses 2

Markdown supported · ⌘↵ to post

[iamGpower](https://hashnode.com/@iamGpower)

[Jun 19, 2022](https://hashnode.com/posts/pure-vs-impure-functions/62833c6f504da209d8557134/comment/62af81f00924134a8048a8f7)

Great writeup [Suprabha Supi](https://hashnode.com/@suprabhasupi). 👍 I would also like to add that:

-   Pure functions allow us to write parallel code.
-   Pure functions output can also be cachable because they always return the same output, increasing code performance.
-   Pure function should be composable or obey the function composition concept.

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

[May 19, 2022](https://hashnode.com/posts/pure-vs-impure-functions/62833c6f504da209d8557134/comment/6285cc0983966a1653f13ab1)

"As you all know that JavaScript is synchronous, using console or any callback or promise/fetch will make the function asynchronous."

Using console doesn't make the function asynchronous. It may likely make it technically impure though (although it doesn't affect the idempotency of the function either, so that's debatable). To be clear, a function that calls another function can still be a pure function.
