JavaScript is a hybrid language. It has some features from each of these three programming styles:
procedural
functional
object-oriented
The overlap between these three can be messy :-(
Style | Behavior | Local State | Shared State |
---|---|---|---|
procedural | functions | variables | globals |
functional | functions | variables | nested scope |
object-oriented | methods, classes |
variables | properties, static methods, class definitions |
Note that:
All of these styles exist to make code more readable / maintainable / debuggable for humans...
https://www.youtube.com/watch?v=FZkjE1_0XtI
...to the CPU, it's all just ones and zeros.
/