DEV Community

Discussion on: Functional Programming in JavaScript? Yes, Please.

Collapse
 
pamblam profile image
Rob Parham

wat u talkin bout willis? js is oop. literally everything is javascript is an object. even a strings an numbers are natural objects in js. you can do "mystring".length because a string is an object with a length property. you can do (123.123).toFixed() because all numbers are objects with a toFixed method. if you think you have to "force" js into oop then you don't understand the language.

Thread Thread
 
tiffany profile image
tiff

What I actually meant by that is using Classical Inheritance with faux classes and instantiating a new object with things like the new keyword instead of Prototypal Inheritance. Prototypal inheritance is more flexible and is probably the best part of JavaScript's OOP implementation.

Thread Thread
 
pamblam profile image
Rob Parham

Good to hear you say that. I fully agree. Most people don't like the whole prototype thing but I love it.

Thread Thread
 
tiffany profile image
tiff

Coming from doing Java at university, it's taken a while to dig prototypes. I am still working on learning to actually love it. But I understand its power.