JS Interview Question: How do you organize your code? (module pattern, classical inheritance?)

There are several options in implementing Module Pattern. An option I mostly use is Object Literal Notation for encapsulating and organizing my code, but upon further readings, Module Pattern using Anonymous Closures, Global Import, and Module Export have sparked my interest as it provides more features for private and public var/methods. It still uses object literal but as to return values from the scoping function.

In JavaScript, the Module pattern is used to further emulate the concept of classes in such a way that we’re able to include both public/private methods and variables inside a single object, thus shielding particular parts from the global scope.
- Addy Osmani, Learning Javascript Design Patterns

There are popular javascript module framework that specifically implemented Module Pattern such as Dojo, ExtJS, YUI, and jQuery. Good to know if your new to learning Javascript concepts and have heard of these technologies before those popular MVC frameworks (Angular.js, Ember.js, Backbone.js) emerged.

Another implementation of module pattern popularized Christian Heilmann (which I think is pretty clean and neat) is The Revealing Module Pattern. It’s pretty much the same with the standard Module Pattern except it uses the return object literal properties as references to variables and functions from the scoping function to export variables and methods.

Also

If you are looking for a platform to develop your clients’ website, check out my SAAS platform https://ecompurpl.com :)

EcomPurpl.com is the all-in-one solution for anyone looking to create a website. Templates, E-Commerce, Hosting, Galleries, Booking & Appointments, CRM, 24/7 support, and integration of your app are all included.

--

--

--

Software Engineer / Front-End Dev. Currently resides in Las Vegas. https://ecompurpl.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Dont React that way part 2

Half You Heard?

How to sign and submit cardano-cli transaction using Nami Wallet

A Future Made of JavaScript

Interview Preparation: JavaScript

3 Layers of Progressive Enhancement

Show or print the current time using javascript in your web Page.

Javascript function or setinterval methood| Shivam Abraham | Mr Abtaham

Create your first Angular App

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
RLyn Ben

RLyn Ben

Software Engineer / Front-End Dev. Currently resides in Las Vegas. https://ecompurpl.com

More from Medium

I will convert psd, xd, figma, sketch to html css bootstrap

< Lets Git to it >_

HOW CSS IS APPLIED TO HTML ELEMENTS?

5 Great Studio Visual Code Extensions I Use