---
title: "Discussion on \"The Scope Chain, Scope and Lexical Environment in Javascript...\" | Hashnode"
description: "Discussion on \"The Scope Chain, Scope and Lexical Environment in Javascript...\". Scope of a Variable and Function.\n\nWe can define a scope where, we can access the variables and function in an Javascript Code.\n\nWe will try understand the scope with the help of an example.\nvar x =10;\n\nfunction a (){\nvar x =20;\nconsole.log(x)\n}\n\nfun..."
url: "https://hashnode.com/posts/the-scope-chain-scope-and-lexical-environment-in-javascript/633f283e9077dc8593e5a6a4"
---

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

Discussion

# [The Scope Chain, Scope and Lexical Environment in Javascript...](https://amitprajapati.hashnode.dev/the-scope-chain-scope-and-lexical-environment-in-javascript?utm_source=hashnode&utm_medium=feed)

Scope of a Variable and Function. We can define a scope where, we can access the variables and function in an Javascript Code. We will try understand the scope with the help of an example. var x =10; function a (){ var x =20; console.log(x) } fun...

Oct 6, 2022 · 2 min read · amitprajapati.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#scope-chain](https://hashnode.com/tag/scope-chain)
-   [#lexical-environment](https://hashnode.com/tag/lexical-environment)

## Written by

[Amit Prajapati](https://hashnode.com/@amiblogger)

@amiblogger

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

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
