There are a variety of common situations and obstacles programmers deal with. Over time many design patterns emerged that nicely addressed these common issues. Of these, there are four patterns that MORE q
By DarkMG73 on April 17th, 2020 inProgramming Methodologies in JavaScript
OOP uses inheritance, via super-classes and sub-classes, and structures code around "what something is". The approach is similar to packing everything each item will need in a box, then only pulling out what is needed when it is needed. Basic QualitiesOnly a few functions work on common data. Uses an inheritance model. Object state can be modified. Functions use side-effects. Three potential problems with an inheritance model:Sub-classes might only need (or perhaps should only use) one method, yet they still absorb all methods from the parent classes. There is potential fragility if changes to a super-class has unforeseen affects on a sub-class. The state of an object and function side-effects can become difficult to manage as projects get larger. Functional Programming uses composition, via an MORE q
By DarkMG73 on April 15th, 2020 inStrict Mode in JavaScript
Strict mode can be turned on by the developer to run a variant of JavaScript in the browser. This variant uses different semantics to run JS code. Initiating this is as simple as writing: 'use strict'; One use case is as a temporary measure during development to uncover errors that would otherwise fail silently. In addition, if browser support can be MORE q
By DarkMG73 on April 14th, 2020 inModules in JavaScript
Error Handling & Debugging
JavaScript is decently equipped to get a handle on errors that may arise. The first tool we should know is the Error Object. const myError = new Error('Oh No!'); throw myError.name + myError.message + myError.stack; Built-in Error Objects are numerous. A complete MORE q
By DarkMG73 on March 27th, 2020 in