---
title: "Discussion on \"why does the console return undefined on executing the log method?\" | Hashnode"
description: "Discussion on \"why does the console return undefined on executing the log method?\". I write console.log(7) and press enter. The log output appears as expected, however, the next line shows undefined. Why is this?\n\nThat is because the developer tools console executes the code first and shows the returned value then. It works the same..."
url: "https://hashnode.com/posts/why-does-the-console-return-undefined-on-executing-the-log-method/63ee2edffef68f13152767c1"
---

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

Discussion

# [why does the console return undefined on executing the log method?](https://thevishalsinghrawat.hashnode.dev/why-does-the-console-return-undefined-on-executing-the-log-method?utm_source=hashnode&utm_medium=feed)

I write console.log(7) and press enter. The log output appears as expected, however, the next line shows undefined. Why is this? That is because the developer tools console executes the code first and shows the returned value then. It works the same...

Feb 16, 2023 · 1 min read · thevishalsinghrawat.hashnode.dev  
Read the article

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

## Written by

[Vishal Singh Rawat](https://hashnode.com/@thevishalsinghrawat)

@thevishalsinghrawat

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

Web Developer

## Responses 1

Markdown supported · ⌘↵ to post

[Saurabh Rawat](https://hashnode.com/@SaurabhR)

[Feb 17, 2023](https://hashnode.com/posts/why-does-the-console-return-undefined-on-executing-the-log-method/63ee2edffef68f13152767c1/comment/63ef046846e2f1644c4f27e3)

Your way of explaining is excellent. It is concise and straightforward, without unnecessary elaboration. Keep up the good work and best of luck to you!

[Feb 20, 2023](https://hashnode.com/posts/why-does-the-console-return-undefined-on-executing-the-log-method/63ee2edffef68f13152767c1/comment/63ef046846e2f1644c4f27e3#reply-63f3a99291a509b61ed01a72)

Thank you!!❤️
