We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bf523f commit 3e68c99Copy full SHA for 3e68c99
1 file changed
js_basics/scope.js
@@ -0,0 +1,21 @@
1
+// Global Scope:
2
+
3
+// Variables declared outside of any function have global scope.
4
5
+// They can be accessed from anywhere in the code, including inside functions.
6
+// const a = 45;
7
+// if(true){
8
+// console.log(a);
9
+// }
10
11
+// Local Scope:
12
13
+// Variables declared inside a function have local scope.
14
15
+// They can only be accessed within the function where they are declared.
16
17
18
+// const b = 59;
19
20
21
+// console.log(b); //it give u the error b is not defined
0 commit comments