---
title: "Discussion on \"Why does a function returns undefined when called?\" | Hashnode"
description: "Discussion on \"Why does a function returns undefined when called?\". A function always returns a value. If a function does not return any value explicitly, it'll return undefined implicitly."
url: "https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375"
---

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

Discussion

# [Why does a function returns undefined when called?](https://patroswastik.hashnode.dev/why-does-a-function-returns-undefined-when-called?utm_source=hashnode&utm_medium=feed)

A function always returns a value. If a function does not return any value explicitly, it'll return undefined implicitly.

Feb 16, 2023 · 4 min read · patroswastik.hashnode.dev  
Updated Mar 10, 2023  
Read the article

-   [#function](https://hashnode.com/tag/function)
-   [#undefined](https://hashnode.com/tag/undefined)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#javascript-behind-the-scene](https://hashnode.com/tag/javascript-behind-the-scene)

## Written by

[Swastik Patro](https://hashnode.com/@swastikpatro)

@swastikpatro · Kalyan, Maharashtra, India

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

#justcode

I am a developer from India. Currently transitioning from Statistician to Software Engineering.

## Responses 3

Markdown supported · ⌘↵ to post

[Jatin Singh](https://hashnode.com/@JatinSingh08)

[Feb 19, 2023](https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375/comment/63f2304caeb8b09284670b9d)

Very deeply explained Swastik...keep it up 🔥

[Swastik Patro](https://hashnode.com/@swastikpatro)

[Feb 22, 2023](https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375/comment/63f2304caeb8b09284670b9d#reply-63f5e5a4437bc8d091bcf896)

Thanks Jatin 💖

[Raj Kishor Shaw](https://hashnode.com/@rajkishorshaw)

[Feb 16, 2023](https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375/comment/63ee257b46e2f1644c4f1399)

Nice and easy to understand for beginners. Looking forward to reading more blogs from you.

[Swastik Patro](https://hashnode.com/@swastikpatro)

[Feb 16, 2023](https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375/comment/63ee257b46e2f1644c4f1399#reply-63ee36453c9c765be7a4507a)

Thanks Raj, Glad you liked it.

[Anand Baraik](https://hashnode.com/@anandbaraik)

[Feb 16, 2023](https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375/comment/63ee171a46e2f1644c4f1113)

It's different than all other blog i have read. Very well put everything.

[Swastik Patro](https://hashnode.com/@swastikpatro)

[Feb 16, 2023](https://hashnode.com/posts/why-does-a-function-returns-undefined-when-called/63edfa579dbf3f24b8294375/comment/63ee171a46e2f1644c4f1113#reply-63ee1c553c9c765be7a44aa6)

Thanks Anand 💖
