-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathRevision_3june.js
114 lines (77 loc) · 1.84 KB
/
Revision_3june.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Function Statement vs Function expression
// function statment
function mutliply(a, b) {
return a * b;
}
// const data = mutliply(a, b); // doing function call assignining value to the data
// function expression
const addTwoNumber = function (a, b) {
return a + b;
};
const divide = (a, b) => {
return a / b;
};
console.log(mutliply(3, 5)); // 15
console.log(addTwoNumber(3, 5)); // 8
console.log(divide(10, 5)); // 2
// console.log("add", add); //
// console.log(add(1, 2)); // this will give you the error
// anonymous function
const getData = function () {};
console.log(getData);
getData();
function addMe(func, a, b) {
// func is here reference
func(a, b);
}
const printData = (x1, x2) => {
console.log(x1, x2);
};
addMe(printData);
addMe((x1, x2) => {
console.log(x1, x2);
});
let count = 0;
// setInterval(() => {
// console.log("hey", count++);
// }, 1000);
var b = 30;
var c = 30;
var a1 = 20;
var a2 = "20";
var a11 = 30;
a11 = "20";
console.log(b, c);
console.log(b, c);
//
// error type in javascript
// Syntax Error
// Logic Error
// Runtime Error
// Reference Error => You are trying to access the variable which is not defined
// console.log(school);
// Type Error
// there is some function and properties for particular data type , if you try to use that function property outside of that data type than you will this error
var lastName = " Vishal ";
console.log(lastName.trim());
var data = [1, 2, 3];
// console.log(data.trim());
// throw "handling proper message";
try {
throw "handling proper message";
} catch (error) {
console.log(error);
}
var data = [1, 2, 3, 4];
// destructing
const [c1, c2, c3] = data;
console.log(c1, c2, c3);
console.log(data);
const a111 = [1, 2, 3];
function add(f1, f2, f3) {
console.log("hey", f1, f2, f3);
}
add(...a111); //add(1,2,3)
// a =1 ,
// b=2 ,
// c=3