Skip to content

Commit 3656d64

Browse files
committed
exec: explain-the-difference-between-classical-inheritance-and-prototypal-inheritance
1 parent 9c4464c commit 3656d64

File tree

1 file changed

+3
-3
lines changed
  • questions/explain-the-difference-between-classical-inheritance-and-prototypal-inheritance

1 file changed

+3
-3
lines changed

questions/explain-the-difference-between-classical-inheritance-and-prototypal-inheritance/en-US.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Prototypal inheritance is a feature of JavaScript where objects inherit directly
5252

5353
Example in JavaScript:
5454

55-
```js
55+
```js live
5656
const animal = {
5757
eat() {
5858
console.log('This animal eats food.');
@@ -64,8 +64,8 @@ dog.bark = function () {
6464
console.log('The dog barks.');
6565
};
6666

67-
dog.eat(); // Inherited method
68-
dog.bark(); // Own method
67+
dog.eat(); // Inherited method (Output: The animal eats food.)
68+
dog.bark(); // Own method (Output: The dog barks.)
6969
```
7070

7171
### Key differences

0 commit comments

Comments
 (0)