Hacker News new | past | comments | ask | show | jobs | submit login

Using OOP in JS is not necessary per se, but when writing complex apps it helps to keep things clean.

Say you're working on a twitter clone for example. It'll make your life much easier if there's a "NewsFeed" class that contains an array of instances of the class "News", which when clicked on shows an instance of "NewsDetails". (All of these would be "Views" if you used if you used an MVC framework like Backbone, probably backed by a model class that contains news data like the tweet content, the # of re-tweets, etc.)

You could do all of the above without using objects; it's just that your code will be a lot messier IMO.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: