-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonDetails.js
46 lines (40 loc) · 983 Bytes
/
PersonDetails.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
class Person{
constructor(name, age, gender, district,state,blood_group){
this.name = name;
this.age = age;
this.gender = gender;
this.district = district;
this.state = state;
this.blood_group = blood_group;
}
getName(){
return this.name;
}
getAge(){
return this.age;
}
getState(){
return this.state;
}
setName(name){
this.name = name;
}
setAge(age){
this.age = age;
}
setState(state){
this.state = state;
}
}
const person = new Person("Jo",24,"Female","Kaniyakumari","Tamil Nadu","AB+")
console.log("Initial Name = ",person.getName());
console.log("Initial Age = ",person.getAge());
console.log("Initial State = ",person.getState());
//setting new values
person.setName("Evan");
person.setAge(27);
person.setState("Bengaluru");
//Upated values
console.log("Updated Name = ",person.getName());
console.log("Updated Age = ",person.getAge());
console.log("Updated State = ",person.getState());