Skip to content

Commit 12fb27b

Browse files
New Practice examples are added
1 parent 78bac70 commit 12fb27b

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

firstclassfunc.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// First Class Function :
2-
// A function is a value that can be assigned to a variable and passed as an argument to another function.
3-
// It's also a type of object in JavaScript, with properties and methods just like any other object.
1+
//* First Class Function :
2+
//* A function is a value that can be assigned to a variable and passed as an argument to another function.
3+
//* It's also a type of object in JavaScript, with properties and methods just like any other object.
44

55
var a = function firstcls() {
66
console.log("hii");
77
};
88
a();
99

10-
//firstcls(function () {});
11-
// or
10+
//?firstcls(function () {});
11+
//? or
1212

13-
//setTimeout(function () {}, 3000);
13+
//?setTimeout(function () {}, 3000);

practice.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
const inter = function () {
2-
console.log("Hello");
3-
};
1+
// const arr1 = [1, 2, 3];
2+
// const arr2 = arr1;
3+
// console.log(arr2);
4+
// arr1.pop(1);
5+
// console.log(arr2);
6+
// console.log(arr1);
47

5-
setTimeout(inter, 1000);
8+
// var x = 2;
9+
// var y = x;
10+
// console.log(x);
11+
// x = 3;
12+
// console.log(y);
613

7-
console.log(x);
8-
var x = 12;
14+
const fib = n => {
15+
if (n <= 1) return 1
16+
return fib(n - 1) + fib(n - 2)
17+
}
18+
19+
const res = fib(9);
20+
console.log("Result - ",res)

0 commit comments

Comments
 (0)