-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectClass.js
More file actions
105 lines (88 loc) · 2.25 KB
/
Copy pathObjectClass.js
File metadata and controls
105 lines (88 loc) · 2.25 KB
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
/*Objects*/
// const student={
// fullName:'Raja',
// marks:92,
// printMarks: function(){
// console.log('Marks= ',this.marks);
// }
// }
// const employee={
// calculateTax(){
// console.log("Tax is 10%");
// }
// }
// const Ramu={
// salary:25000,
// }
// //to prototype one obj to another Obj
// Ramu.__proto__=employee;
/* Classes*/
// class Car{
// start(){
// console.log("Start");
// }
// stop(){
// console.log("Stop");
// }
// //constructor->constructor invoke itself with object as newcarobj
// constructor(brand){
// console.log("Car is created");
// this.brand=brand;
// }
// }
// //obj creation->this obj conatins all class properties
// let newcar=new Car("fortuner");
// // console.log("new car",newcar);
/*Inheritance*/
// class parent{
// hello(){
// console.log("Hello");
// }
// }
// //inherit parent properties into child
// class child extends parent {};
// let obj=new child();
// console.log(obj);
// console.log(obj.hello());
// class Person{
// eat(){
// console.log("Eat");
// }
// sleep(){
// console.log("Sleep");
// }
// }
// class Engineer extends Person{
// work(){
// console.log("Problem solving");
// }
// }
// let rahulobj=new Engineer();
// console.log(rahulobj);
/*Super */
//To acees the parent constructor in child if both have constructor
/*Practice Question*/
// class user{
// constructor(name,mail){
// this.name=name;
// this.mail=mail;
// }
// UserDate(){
// console.log("User Data");
// }
// }
// let user1=new user('rahul','abc@gmail.com');
// let user2=new user('ram','xyz@gmail.com');
// console.log(user1);
/*Erroe Handeling*/
let a=5;
let b=10;
console.log("a =",a);
console.log("b =",b);
try{
console.log("a+b=",a+c);
}catch(err){
console.log(err);
}
console.log("a+b=",a+b);
console.log("a+b=",a+b);