Skip to content

Instantly share code, notes, and snippets.

View stuarthallows's full-sized avatar

Stuart Hallows stuarthallows

  • Willow Inc.
  • Adelaide, Australia
View GitHub Profile
@stuarthallows
stuarthallows / structuringJavaScript.js
Last active January 16, 2019 15:51
Notes from the Pluralsight course, 'Structuring JavaScript Code'.
// PROTOTYPE
// Modularize code into re-usable objects, take variables and functions out of global namespace,
// functions loaded into memory once whereas the state is all held in the objects, can override
// functions through prototyping.
// Drawbacks: heavy use of 'this' keyword and the constructor is separate from the prototype definition.
var Calculator = function(eq) {
// Variables defined in constructor and are unique to each instance.
this.eqCtl = document.GetElementById(eq);