Skip to content

Commit cbb4e58

Browse files
committed
path updated
1 parent a889765 commit cbb4e58

17 files changed

Lines changed: 428 additions & 428 deletions
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
class User {
2-
constructor(id, name, age, email, phone) {
3-
console.log(`Info of Candidate no ${id} : `);
4-
this.id = id;
5-
this.name = name;
6-
this.age = age;
7-
this.email = email;
8-
this.phone = phone;
9-
}
10-
info() {
11-
console.log(`Candidate' Name: ${this.name}`);
12-
console.log(`Candidate' Age: ${this.age}`);
13-
}
14-
contact() {
15-
console.log(
16-
`Candidate's email: ${this.email} \nCandidate' phone: ${this.phone} `
17-
);
18-
}
19-
}
20-
const pain = new User(49, "Pain", 24, "[email protected]", 0189661796);
21-
pain.info();
22-
pain.contact();
23-
24-
console.log("---------------------");
25-
26-
class newUser extends User {
27-
constructor(id, name, age, email, phone, city) {
28-
//super refers to the parent class
29-
//super must be called before any use of keyword this
30-
super(id, name, age, email, phone);
31-
this.city = city;
32-
}
33-
address() {
34-
console.log(`Current city: ${this.city}`);
35-
}
36-
}
37-
const rakin = new newUser(
38-
03,
39-
"Rakin",
40-
42,
41-
42-
01889445,
43-
"Sylhet"
44-
);
45-
rakin.info();
46-
rakin.contact();
47-
rakin.address();
48-
49-
console.log("\n");
50-
console.log(typeof User);
51-
console.log(typeof newUser);
1+
class User {
2+
constructor(id, name, age, email, phone) {
3+
console.log(`Info of Candidate no ${id} : `);
4+
this.id = id;
5+
this.name = name;
6+
this.age = age;
7+
this.email = email;
8+
this.phone = phone;
9+
}
10+
info() {
11+
console.log(`Candidate' Name: ${this.name}`);
12+
console.log(`Candidate' Age: ${this.age}`);
13+
}
14+
contact() {
15+
console.log(
16+
`Candidate's email: ${this.email} \nCandidate' phone: ${this.phone} `
17+
);
18+
}
19+
}
20+
const pain = new User(49, "Pain", 24, "[email protected]", 0189661796);
21+
pain.info();
22+
pain.contact();
23+
24+
console.log("---------------------");
25+
26+
class newUser extends User {
27+
constructor(id, name, age, email, phone, city) {
28+
//super refers to the parent class
29+
//super must be called before any use of keyword this
30+
super(id, name, age, email, phone);
31+
this.city = city;
32+
}
33+
address() {
34+
console.log(`Current city: ${this.city}`);
35+
}
36+
}
37+
const rakin = new newUser(
38+
03,
39+
"Rakin",
40+
42,
41+
42+
01889445,
43+
"Sylhet"
44+
);
45+
rakin.info();
46+
rakin.contact();
47+
rakin.address();
48+
49+
console.log("\n");
50+
console.log(typeof User);
51+
console.log(typeof newUser);
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
class Person {
2-
// *define properties in constructor
3-
constructor(name, surname, gender, age, aim) {
4-
console.log(`${name} is from ${surname.toUpperCase()} family`);
5-
// !constructor gets invoked only once
6-
this.name = name;
7-
this.surname = surname;
8-
this.gender = gender;
9-
this.age = age;
10-
this.aim = aim;
11-
}
12-
// method
13-
info() {
14-
console.log(`Gender is ${this.gender} & ${this.age} year old`);
15-
}
16-
target() {
17-
console.log(`Aim in Life: to be a ${this.aim}`);
18-
}
19-
}
20-
const rakib = new Person(
21-
"Rakib",
22-
"Talukder",
23-
"Male",
24-
25,
25-
"Front-End Developer"
26-
);
27-
rakib.info();
28-
rakib.target();
29-
30-
console.log("---------------------");
31-
32-
const zakir = new Person(
33-
"Zakir",
34-
"Hossain",
35-
"Male",
36-
28,
37-
"Full Stack Developer"
38-
);
39-
zakir.info();
40-
zakir.target();
1+
class Person {
2+
// *define properties in constructor
3+
constructor(name, surname, gender, age, aim) {
4+
console.log(`${name} is from ${surname.toUpperCase()} family`);
5+
// !constructor gets invoked only once
6+
this.name = name;
7+
this.surname = surname;
8+
this.gender = gender;
9+
this.age = age;
10+
this.aim = aim;
11+
}
12+
// method
13+
info() {
14+
console.log(`Gender is ${this.gender} & ${this.age} year old`);
15+
}
16+
target() {
17+
console.log(`Aim in Life: to be a ${this.aim}`);
18+
}
19+
}
20+
const rakib = new Person(
21+
"Rakib",
22+
"Talukder",
23+
"Male",
24+
25,
25+
"Front-End Developer"
26+
);
27+
rakib.info();
28+
rakib.target();
29+
30+
console.log("---------------------");
31+
32+
const zakir = new Person(
33+
"Zakir",
34+
"Hossain",
35+
"Male",
36+
28,
37+
"Full Stack Developer"
38+
);
39+
zakir.info();
40+
zakir.target();
Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
//? Constructors are the template which we can use to create more objects with similar properties.
2-
3-
function Person(name, age, email) {
4-
this.name = name;
5-
this.age = age;
6-
this.email = email;
7-
}
8-
const person1 = new Person("Rakin", 4, "killer@kill");
9-
const person2 = new Person("Fahmid", 8, "filler@fill");
10-
console.log(person1);
11-
console.log(person2);
12-
13-
class Individual {
14-
constructor(name, age, email) {
15-
console.log("Info Of Individual:");
16-
this.name = name;
17-
this.age = age;
18-
this.email = email;
19-
}
20-
getName = () => {
21-
return `Hello ${this.name}`;
22-
};
23-
}
24-
const individual1 = new Individual("Sadika", 11, "[email protected]");
25-
console.log(individual1);
26-
console.log(individual1.getName());
27-
28-
class Developer extends Individual {
29-
constructor(name, age, email, position) {
30-
super(name, age, email);
31-
this.position = position;
32-
}
33-
getInfo = () => {
34-
console.log(`Hello I'm ${this.name}`);
35-
console.log(`Hello I'm ${this.age} years old`);
36-
};
37-
job() {
38-
console.log(`Current position: ${this.position}`);
39-
}
40-
}
41-
const developerFront = new Developer(
42-
"Labib",
43-
13,
44-
"email",
45-
"Front End Developer"
46-
);
47-
developerFront.getInfo();
48-
developerFront.job();
1+
//? Constructors are the template which we can use to create more objects with similar properties.
2+
3+
function Person(name, age, email) {
4+
this.name = name;
5+
this.age = age;
6+
this.email = email;
7+
}
8+
const person1 = new Person("Rakin", 4, "killer@kill");
9+
const person2 = new Person("Fahmid", 8, "filler@fill");
10+
console.log(person1);
11+
console.log(person2);
12+
13+
class Individual {
14+
constructor(name, age, email) {
15+
console.log("Info Of Individual:");
16+
this.name = name;
17+
this.age = age;
18+
this.email = email;
19+
}
20+
getName = () => {
21+
return `Hello ${this.name}`;
22+
};
23+
}
24+
const individual1 = new Individual("Sadika", 11, "[email protected]");
25+
console.log(individual1);
26+
console.log(individual1.getName());
27+
28+
class Developer extends Individual {
29+
constructor(name, age, email, position) {
30+
super(name, age, email);
31+
this.position = position;
32+
}
33+
getInfo = () => {
34+
console.log(`Hello I'm ${this.name}`);
35+
console.log(`Hello I'm ${this.age} years old`);
36+
};
37+
job() {
38+
console.log(`Current position: ${this.position}`);
39+
}
40+
}
41+
const developerFront = new Developer(
42+
"Labib",
43+
13,
44+
"email",
45+
"Front End Developer"
46+
);
47+
developerFront.getInfo();
48+
developerFront.job();
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
// !Static class methods are defined on the class itself.
2-
// !use the static keyword to indicate to that this method doesn't use information from the current instance
3-
// !If we create a method that does not access an instance property, we can use the static keyword.
4-
class Triple {
5-
static intro() {
6-
console.log("Intro to Static Method");
7-
}
8-
static customName = "Triple";
9-
static details = "Use me to triple any number";
10-
static triple(n = 1) {
11-
return n * 3;
12-
}
13-
}
14-
Triple.intro();
15-
console.log(Triple.customName);
16-
console.log(Triple.details);
17-
console.log(Triple.triple());
18-
console.log(Triple.triple(5));
19-
20-
class doubleTriple extends Triple {
21-
static details = "I square the triple of any number you provide";
22-
static triple(n) {
23-
return super.triple(n) * super.triple(n);
24-
}
25-
}
26-
console.log(doubleTriple.triple(5)); // !(not affected by parent's instantiation)
27-
console.log(doubleTriple.customName); //output from Triple
28-
29-
console.log("---------------------");
30-
class MathOperations {
31-
static add(n1, n2) {
32-
return n1 + n2;
33-
}
34-
static minus(n1, n2) {
35-
return n1 - n2;
36-
}
37-
}
38-
// ?Static Methods
39-
console.log(MathOperations.add(5, 5));
40-
console.log(MathOperations.minus(15, 5));
41-
42-
// !Cannot access static values on instance
43-
const instance = new MathOperations();
44-
// ?instance.add(); //error undefined
1+
// !Static class methods are defined on the class itself.
2+
// !use the static keyword to indicate to that this method doesn't use information from the current instance
3+
// !If we create a method that does not access an instance property, we can use the static keyword.
4+
class Triple {
5+
static intro() {
6+
console.log("Intro to Static Method");
7+
}
8+
static customName = "Triple";
9+
static details = "Use me to triple any number";
10+
static triple(n = 1) {
11+
return n * 3;
12+
}
13+
}
14+
Triple.intro();
15+
console.log(Triple.customName);
16+
console.log(Triple.details);
17+
console.log(Triple.triple());
18+
console.log(Triple.triple(5));
19+
20+
class doubleTriple extends Triple {
21+
static details = "I square the triple of any number you provide";
22+
static triple(n) {
23+
return super.triple(n) * super.triple(n);
24+
}
25+
}
26+
console.log(doubleTriple.triple(5)); // !(not affected by parent's instantiation)
27+
console.log(doubleTriple.customName); //output from Triple
28+
29+
console.log("---------------------");
30+
class MathOperations {
31+
static add(n1, n2) {
32+
return n1 + n2;
33+
}
34+
static minus(n1, n2) {
35+
return n1 - n2;
36+
}
37+
}
38+
// ?Static Methods
39+
console.log(MathOperations.add(5, 5));
40+
console.log(MathOperations.minus(15, 5));
41+
42+
// !Cannot access static values on instance
43+
const instance = new MathOperations();
44+
// ?instance.add(); //error undefined

0 commit comments

Comments
 (0)