I'm in a beginning HTML class and our textbook says that JavaScript is an object-based scripting language. On our quiz, one of the questions was "JavaScript is an object-oriented scripting language, True or False." I put False because it's my understanding that object-based and object-oriented are two different things. I got the answer wrong.
Is JavaScript indeed an object-oriented language?
Thanks for any clarification you can give!
JavaScript uses prototype-based programming, which is a type of object oriented programming. Prototypes are a way of reusing behaviors by cloning existing objects instead of doing class based inheritance. It's different enough from the standard class based object oriented programming that few people bother to learn it well enough to make good use of it.
http://en.wikipedia.org/wiki/Prototype-based_programming is a useful reference.
The definition of Object Oriented is sometimes subjective. For some, any language that deals with "Objects", is Object Oriented. For others, the entire language and its construct must utilize objects to be counted as Object Oriented (think SmallTalk or Java).
In javascript, you're able to write a script that has no objects in it or you can create heavily object oriented code. Whether or not you call it Object Oriented is really dependant on what school of thought you follow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With