Inheritance vs Composition in JavaScriptby@serhiirubets
1,166 reads

Inheritance vs Composition in JavaScript

tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

Inheritance is one of the core concepts of object-oriented programming, that helps us, developers to avoid code duplication. The main idea is that we create a base class, which contains logic, that will be reused by our subclasses. Unlike inheritance, the composition uses a **has-a** relationship. We collect different pieces of functionality together. For example, “***Form***” is an ‘***Element***’ and ‘*Element’ is a ‘**Element*’

Company Mentioned

Mention Thumbnail
featured image - Inheritance vs Composition in JavaScript
Serhii Rubets HackerNoon profile picture

@serhiirubets

Serhii Rubets

Learn More
LEARN MORE ABOUT @SERHIIRUBETS'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart
Serhii Rubets HackerNoon profile picture
by Serhii Rubets @serhiirubets.I'm a Fullstack JS engineer with 7 years of experience. Also, I'm a mentor, teacher, and author of front-end courses.
Read my stories

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa