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 in
A promise returns the same data as a callback function, but can await the reply. With this, when there is a delay receiving data, the syntax is nicer and the better error handing. Most importantly, the browser can continue processing the page and then fill in the delayed data whenever it is ready. The above allows for JavaScript to step away from the normal synchronous processing order, which is running commands one after the other in the order MORE q
By DarkMG73 on April 17th, 2020 in
In English, "scope" is defined as: "The extent of the area that something is relevant". In JavaScript, this definition holds, with one small adjustment: "The extent of the area that something is accessible". With this in mind there are two basic areas with which a variable can be contained and is accessible: globally and locally. Global Scope Variables with global scope are part of the global object. In a web browser, this MORE q
By DarkMG73 on April 16th, 2020 in
Here I compare Object-Oriented Programming (OOP) and Functional Programming, highlighting their fundamental differences. OOP utilizes inheritance and encapsulates data, focusing on "what something is", while Functional Programming emphasizes function composition and immutability, concentrating on "what something has". Both methods have benefits and drawbacks influencing code clarity, maintainability, and memory efficiency. MORE q
By DarkMG73 on April 15th, 2020 in
Here I explore how to utilize the JavaScript DOM Web API to manipulate document elements. It highlights methods for accessing and modifying elements, such as retrieving elements by ID, creating new ones, and altering styles. Additionally, it describes various data types within the DOM API, enhancing understanding of its structure and capabilities. MORE q
By DarkMG73 on April 14th, 2020 in
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 in