---
title: "Discussion on \"Why console gives \"undefined\" after printing a output?\" | Hashnode"
description: "Discussion on \"Why console gives \"undefined\" after printing a output?\". Given in the above image what you expect the console to print out?\n42, Right. But did you notice? That it also gives \"undefined\" in its second line of output. Why is that? let's dive deep into it and understand what actually works behind it.\nThe abov..."
url: "https://hashnode.com/posts/why-console-gives-undefined-after-printing-a-output/63ecacabe7b234c9a915091b"
---

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

Discussion

# [Why console gives "undefined" after printing a output?](https://mainak99.hashnode.dev/why-console-gives-undefined-after-printing-a-output?utm_source=hashnode&utm_medium=feed)

Given in the above image what you expect the console to print out? 42, Right. But did you notice? That it also gives "undefined" in its second line of output. Why is that? let's dive deep into it and understand what actually works behind it. The abov...

Feb 15, 2023 · 2 min read · mainak99.hashnode.dev  
Read the article

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

## Written by

[Mainak Halder](https://hashnode.com/@Mainak99dev)

@Mainak99dev · India

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

Keen to discover

Tech enthusiast. (Full- stack developer)

## Responses 1

Markdown supported · ⌘↵ to post

[P Mujahid Khan](https://hashnode.com/@MujahidKhan)

[Feb 16, 2023](https://hashnode.com/posts/why-console-gives-undefined-after-printing-a-output/63ecacabe7b234c9a915091b/comment/63ede3de46e2f1644c4f07c1)

mainak congrats on your first blog keep going !
