We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c4464c commit 3656d64Copy full SHA for 3656d64
questions/explain-the-difference-between-classical-inheritance-and-prototypal-inheritance/en-US.mdx
@@ -52,7 +52,7 @@ Prototypal inheritance is a feature of JavaScript where objects inherit directly
52
53
Example in JavaScript:
54
55
-```js
+```js live
56
const animal = {
57
eat() {
58
console.log('This animal eats food.');
@@ -64,8 +64,8 @@ dog.bark = function () {
64
console.log('The dog barks.');
65
};
66
67
-dog.eat(); // Inherited method
68
-dog.bark(); // Own method
+dog.eat(); // Inherited method (Output: The animal eats food.)
+dog.bark(); // Own method (Output: The dog barks.)
69
```
70
71
### Key differences
0 commit comments