-
what is Scope?Study/JavaScript 2020. 4. 30. 20:03
Scope
An important idea in programming is scope. Scope defines where variables can be accessed or referenced. While some variables can be accessed from anywhere within a program, other variables may only be available in a specific context.
You can think of scope like the view of the night sky from your window. Everyone who lives on the planet Earth is in the global scope of the stars. The stars are accessible globally. Meanwhile, if you live in a city, you may see the city skyline or the river. The skyline and river are only accessible locally in your city, but you can still see the stars that are available globally.
Over the next few exercises, we’ll explore how scope relates to variables and learn best practices for variable declaration.
'Study > JavaScript' 카테고리의 다른 글
What are other uses of functions as data? (0) 2020.05.02 for문과 while문의 차이점 (0) 2020.05.01 What are the advantages of function expressions? 함수표현식 vs 함수 선언식 (0) 2020.04.30 Why do I need to use `return`? (0) 2020.04.30 Parameters and Arguments (0) 2020.04.29