---
title: "Discussion on \"Composition vs Inheritance  in Object-Oriented Programming - JavaScript example\" | Hashnode"
description: "Discussion on \"Composition vs Inheritance  in Object-Oriented Programming - JavaScript example\". What are composition and inheritance in Object-Oriented Programming? What are thepros and cons of each? We use JavaScript examples to answer these questions"
url: "https://hashnode.com/posts/composition-vs-inheritance-in-object-oriented-programming-javascript-example/62985ef2b152c40c3702c4f8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Composition vs Inheritance in Object-Oriented Programming - JavaScript example](https://blog.thecode.xyz/composition-vs-inheritance-in-object-oriented-programming-javascript-example?utm_source=hashnode&utm_medium=feed)

What are composition and inheritance in Object-Oriented Programming? What are thepros and cons of each? We use JavaScript examples to answer these questions

Jun 2, 2022 · 4 min read · blog.thecode.xyz  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#object-oriented-programming](https://hashnode.com/tag/object-oriented-programming)
-   [#software-development](https://hashnode.com/tag/software-development)

## Written by

[Tomek Skupiński](https://hashnode.com/@focusinsky)

@focusinsky

  
[View profile](https://hashnode.com/@focusinsky)

Software Engineer, 1/3 of thecode.xyz

I’m Tomek, software engineer, working mostly with Ruby on Rails. I work remotely at Mixlr where every day we deliver live audio to millions of listeners. After hours, I write, read, and help my wife run theCode.xyz

## Responses 1

Markdown supported · ⌘↵ to post

[Mr\*Bite](https://hashnode.com/@MrBitee)

[Jun 3, 2022](https://hashnode.com/posts/composition-vs-inheritance-in-object-oriented-programming-javascript-example/62985ef2b152c40c3702c4f8/comment/629a77dc70302328c80b625a)

Yes it's okay to make money, but many find it hard to safe. I'll love to introduce you'all to fluid finance. With fluid you could send asset's Globally with no charge. Sign up today. [app.fluidfi.ch/invite/Live\_Amoeba\_5058](https://app.fluidfi.ch/invite/Live_Amoeba_5058)
