Spread & Rest in JavaScript

The spread operator allows for an Object's properties to be filled into a another object right in line with existing properties. Likewise, this can fill one array in another array keeping the values in line with existing values. Spread const aNewObject = {...oldObject} const aNewArray = [...oldArray] Rest The rest parameter an array made  MORE q

By on April 18th, 2020 in

Map Data Structure in JavaScript

The Map object holds key-value pairs like a standard object. There are a few significant differences between Map and a regular key-value pair object. These are: Objects: Keys must be obtained and used to iterate over. Map: This is iterable, meaning we can directly iterate. Objects: The key can only be an integer, string, or symbol. Map: Key field can be of any data-type including objects and functions. Objects: Retrieving size is a manual process. Map: The size property hold this info. Objects: Iterating will not always return keys in  MORE q

By on April 17th, 2020 in

Asynchronous Code with JS

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 on April 17th, 2020 in

Scope in JavaScript

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 on April 16th, 2020 in

Programming Methodologies in JavaScript

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 on April 15th, 2020 in

Post Navigation