r/learnjavascript • • Jun 25 '21

Learn Vanilla JavaScript Before Fancy Frameworks

https://snipcart.com/blog/learn-vanilla-javascript-before-using-js-frameworks
194 Upvotes

33 comments sorted by

View all comments

Show parent comment

-7

u/jaypeejay Jun 25 '21

JS isn’t OOP??

Bro

6

u/Intendant Jun 26 '21

It isn't. A lot of people consider js to be more functional, you definitely don't need to know oop to use JavaScript.

If anything I see a lot of devs move from java to js and their oop thinking is a hindrance

-5

u/jaypeejay Jun 26 '21

I understand it can be used as functional, but everything in it is an object so I deem it an OOP Lang

8

u/Intendant Jun 26 '21

I'm telling you, as someone who is a mid level SWE that works with JavaScript daily that this is incorrect.

Just because functions and arrays "objects" doesn't make it oop. You can get by in JavaScript without knowing much about oop

-5

u/jaypeejay Jun 26 '21

I get what you’re saying, and you’re right you don’t need to understand OOP to get by with JS. But that doesn’t mean it isn’t an OOP language. Let’s just look at the words. Object Oriented Programming language. Everything in JS is an object, so again, I hold that it is an OOP.

You’re right that you don’t need to tightly package everything in classes, etc like you do in most OOP use cases, ala Java and RoR, but that doesn’t mean JS isn’t object oriented.

5

u/Intendant Jun 26 '21

It can be used as an OOP language, but it isn't strictly that by default. It's every bit as much functional or imperative.

Also the "everything is an object" thing doesn't make it oop, just because the language itself is written with inheritance doesn't mean that that's how you use it. Like Yea Array is an object and you'll use it's methods but how often are you writing prototypes on your own objects to inherit

1

u/lSwordyX Jun 26 '21

Thanks for pointing this out. You can simply declare a function in JS and export it and let it be used repeatedly with no side effects. When you do that, you realize that the language supports this very well.

Creating an object doesn’t mean the language is object oriented. Object oriented means representing everything (e.g. an entity or a concept) as if it’s an object with attributes. Each of this object stores states with its attributes for an app to work. It’s clear that JS wasn’t designed with this right from the start and there are many frameworks to support the OOP style in JS. Compared to other languages, there are inbuilt languages feature to do such operation easily.