Skip to content

Commit 9d93a1e

Browse files
committedJun 12, 2024
funjs and scope variable is done
1 parent 345dd71 commit 9d93a1e

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
 

‎03_basics/scope.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// console.log("hello world");
2+
let a = 10;
3+
const b = 20;
4+
var c = 30;
5+
if (true) {
6+
let a = 40;
7+
const b = 50;
8+
//console.log("inner", c); //inner 30
9+
var c = 60;
10+
}
11+
// console.log(a); //10
12+
// console.log(b); //20
13+
// console.log(c); //60
14+
let x = "hello this is me .hacker";
15+
const func1 = function () {
16+
let x = "hello this is x";
17+
18+
console.log(x);
19+
};
20+
//func1();
21+
//console.log(x);
22+
const func2 = function () {
23+
const y = "hello this is y";
24+
console.log(y);
25+
};
26+
//func2();
27+
//console.log(y);// y is not defined ...
28+
var z = "hello this is wwwz";
29+
const func3 = function () {
30+
var z = "hello this is z";
31+
console.log(z);
32+
};
33+
34+
//func3();
35+
//console.log(z);
36+
37+
{
38+
var a1 = "wasim";
39+
}
40+
console.log(a1); //wasim
41+
42+
{
43+
const a2 = "qasim";
44+
}
45+
//console.log(a2); // not a2 defined
46+
47+
{
48+
let a4 = "ali";
49+
}
50+
//console.log(a4); // a4 is not defined

‎Fun_js/fun1.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
let a = 2;
2+
let b = 3;
3+
const waseem = function (a, b) {
4+
a = 5;
5+
b = 10;
6+
console.log(a + b);
7+
};
8+
waseem(a, b);
9+
//console.log("waseem akram");
10+
const arr1 = [
11+
"arr1",
12+
{
13+
name: "waseem akram",
14+
class: "bsit",
15+
},
16+
];
17+
console.log(arr1);
18+
console.log(typeof arr1); //it's object..
19+
const c = arr1[1];
20+
console.log(c);

0 commit comments

Comments
 (0)