r/javascript • • Nov 02 '22

Javascript is still the most used programming language in newly created repositories on GitHub

https://ossinsight.io/2022/#top-programming-languages
343 Upvotes

106 comments sorted by

View all comments

Show parent comments

14

u/[deleted] Nov 02 '22

[removed] — view removed comment

1

u/FormerGameDev Nov 03 '22

and it has both traditional class style inheritance, and prototype style inheritance.

Dear God, I hate how people have totally abused prototype style inheritance. It has it's place, but.. there's a reason that even though we've got decent classes now, most everything is moving towards a functional setup. OOP as a paradigm just doesn't make much sense for a lot of the work done in modern apps.

5

u/xroalx Nov 03 '22

and it has both traditional class style inheritance, and prototype style inheritance.

class Foo extends Bar is still achieved using prototypes, and functions, isn't it?

class Bar { }
typeof Bar === 'function' // true

class Foo extends Bar { }
Foo.__proto__ === Bar // true

There's probably something more to class, as it allows you to use private (#) members, which you can't use anywhere else, but other things still look like syntax sugar for constructor functions and prototypes.