We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbb4e58 commit 1fc01d0Copy full SHA for 1fc01d0
1 file changed
OOP/prototypal-inheritance.js
@@ -0,0 +1,15 @@
1
+// prototypical inheritance refers to the ability to access object properties from another object.
2
+let person = {
3
+ greet: function () {
4
+ return `${this.name} is cool`;
5
+ },
6
+};
7
+
8
+let rakib = Object.create(person);
9
+rakib.name = "rakib";
10
+console.log(rakib.name);
11
+console.log(rakib.greet());
12
13
+let writer = Object.create(person);
14
+writer.book = "Kill Me Heal Me";
15
+console.log(writer.book);
0 commit comments