-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
86 lines (76 loc) · 2.06 KB
/
Copy pathtest.js
File metadata and controls
86 lines (76 loc) · 2.06 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
// class Car { // Create a class
// constructor(brand) { // Class constructor
// this.carname = brand; // Class body/properties
// }
// }
// const mycar = new Car("Ford"); // Create an object of Car class
// console.log(typeof Car); // function
// console.log(mycar.carname);
// class Book {
// constructor(name, author) {
// this.bookName = name;
// this.bookAuthor = author;
// }
// showBookName(){
// console.log(this.bookName)
// }
// showBookAuthor(){
// console.log(this.bookAuthor);
// }
// static mystMeth(x){
// console.log(`Static method and the name of the book is ${x.bookName}`)
// }
// static mystMeth2(){
// console.log("This is a static method of the Book class")
// }
// }
// class NoteBook extends Book {
// constructor(name, author){
// super(name, author)
// }
// static mystMeth3(){
// console.log("This is a static method of class NoteBook")
// }
// bName() {
// console.log(this.bookName);
// }
// bAuthor(){
// console.log(this.bookAuthor);
// }
// }
// const first = new Book("Bangla", "XYZ");
// const second = new NoteBook("English", "ABC");
// first.showBookName();
// first.showBookAuthor();
// second.bName();
// second.bAuthor();
// second.showBookName();
// second.showBookAuthor();
// console.log(second.bookName)
// console.log(second.bookAuthor)
// Calling static methods:
// Book.mystMeth(first);
// Book.mystMeth2();
// NoteBook.mystMeth3()
// class Car {
// constructor(brand) {
// this.carname = brand;
// }
// present() {
// return 'I have a ' + this.carname;
// }
// }
// class Model extends Car {
// constructor(brand, mod) {
// super(brand);
// this.model = mod;
// }
// show() {
// return this.present() + ', it is a ' + this.model;
// }
// }
// const mycar = new Model('Ford', 'Mustang');
// console.log(mycar.carname);
// console.log(mycar.model);
// console.log(mycar.present());
// console.log(mycar.show());