Get the App
SLTechnology News&Howtos  ›  Development  › 

Description and use of javascript scope

Shulou Source: shulou.com Published: 2022-06-03 17:31:16 11月13日 Update

This article mainly explains "the description and use of javascript scope". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the description and use of javascript scope".

Description

1. The scope can be understood as the current execution context, and note that it is current.

2. The scope itself does not have the values of variables and methods, but only in the corresponding execution context, that is, variables in different execution contexts will have different values.

Scopes also have subordinate relationships, determining the scope under which a function or variable is created.

Example

Var age = 10 function test () {var age = 100; console.log (age);}; test (); / 100 Thank you for your reading, the above is the content of "description and use of javascript scope". After the study of this article, I believe you have a deeper understanding of the description and use of javascript scope, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Functions contexts variables learning differences contents superiors and subordinates that is functions only examples that is ideas situations articles methods are in more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Information vpn MariaDB Redmi