Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way that Javascript can mimic an object oriented language?

Tags:

javascript

oop

I'm wondering if there is a way that Javascript can mimic an object oriented language. I.e. can you mimic the ability to define customized classes/objects with properties? Since JSON is basically a way of javascript passing objects, I figure there must be some way to create/store objects on the client side, then reuse them? If someone can point me to a good tutorial (if it's possible to do this at all) that would be much appreciated.

Even some example code where you can dynamically create an object, then consume it using jquery would be appreciated.

like image 322
locoboy Avatar asked Dec 10 '22 08:12

locoboy


1 Answers

Javascript is an object oriented language, it's just not a class based object system, but a prototype based one. See this article: http://en.wikipedia.org/wiki/Prototype-based_programming

like image 52
troelskn Avatar answered Dec 29 '22 00:12

troelskn