---
title: "Discussion on \"Everything you need to know about Scope and lexical environment in JavaScript.\" | Hashnode"
description: "Discussion on \"Everything you need to know about Scope and lexical environment in JavaScript.\". Before moving further to learn about Scope. First let's write a simple code.\n\nfunction print() {\n\nconsole.log(\"hello\");\n}\n\nprint();\nAs we know the above code gives us an output of hello. But  instead of writing this if we write like this\nfunction pri..."
url: "https://hashnode.com/posts/all-about-scope-in-javascript/631a351700230a29830dcc17"
---

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

Discussion

# [Everything you need to know about Scope and lexical environment in JavaScript.](https://webdeveloper2212.hashnode.dev/all-about-scope-in-javascript?utm_source=hashnode&utm_medium=feed)

Before moving further to learn about Scope. First let's write a simple code. function print() { console.log("hello"); } print(); As we know the above code gives us an output of hello. But instead of writing this if we write like this function pri...

Sep 8, 2022 · 5 min read · webdeveloper2212.hashnode.dev  
Read the article

-   [#iwritecode](https://hashnode.com/tag/iwritecode)
-   [#lexical-environment](https://hashnode.com/tag/lexical-environment)
-   [#scope](https://hashnode.com/tag/scope)
-   [#ineuron-hiteshchaudhary-webdev-javascript-lco-learncodeonline-lco-css-learncodeonline-cssselectors-hiteshchoudharylco-code-with-hitesh-choudhary](https://hashnode.com/tag/ineuron-hiteshchaudhary-webdev-javascript-lco-learncodeonline-lco-css-learncodeonline-cssselectors-hiteshchoudharylco-code-with-hitesh-choudhary)
-   [#scopeinjavascript](https://hashnode.com/tag/scopeinjavascript)

## Written by

[jitender singh](https://hashnode.com/@jitender2212)

@jitender2212 · Delhi

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

## Responses 1

Markdown supported · ⌘↵ to post

[Deepti Dubey](https://hashnode.com/@Deepti89)

[Sep 10, 2022](https://hashnode.com/posts/all-about-scope-in-javascript/631a351700230a29830dcc17/comment/631cc993f73f4734bc054f8f)

Nice explanation
