-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectclass.js
More file actions
40 lines (29 loc) · 782 Bytes
/
Objectclass.js
File metadata and controls
40 lines (29 loc) · 782 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
class Person{
constructor(name,lname,mobile){
this.name=name;
this.lname=lname;
this.mobile=mobile;
}
getName=function(){
console.log(this.name,this.lname);
}
}
const p1=new Person("pukhraj","kumar",456456123);
const p2=new Person("Kumar","kumar",456456123);
const p3=new Person("javascript","kumar",456456123);
console.log(p2);
console.log(p3);
console.log(p3.getName());
// function constructor
// function Person(name,lname,mobile){
// this.name=name;
// this.lname=lname;
// this.mobile=mobile;
// this.getName=function(){
// console.log(this.name,this.lname);
// }
// }
// const p1=new Person("pukhraj","kumar",456456123);
// const p2=new Person("Kumar","kumar",456456123);
// const p3=new Person("javascript","kumar",456456123);
// console.log(p3.getName())