-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathtryCatch.js
More file actions
46 lines (40 loc) · 867 Bytes
/
tryCatch.js
File metadata and controls
46 lines (40 loc) · 867 Bytes
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
//Try Catch your programming
const data = undefined;
// console.log(data.name)
// try {
// console.log(data.name)
// const a =30;
// const b =40;
// console.log(a+b);
// // if any error comes inside the try block pointer will move to the catch block
// } catch(error) {
// console.log("error::") // error screen
// }
try {
const a =30;
const b =40;
console.log(a+b);
throw("Something went wrong!!!");
} catch(err) {
console.log(err)
}
// finally {
// console.log("Finally")
// }
// try {
// const a =30;
// const b =40;
// console.log(a+b);
// } catch(error){
// console.log("error::" , error)
// } finally {
// console.log("Finally")
// }
try {
const a =30;
const b =40;
console.log(a+b);
throw("Throw error");
} catch(error) {
console.log(error)
}