It can be said that the building blocks of an application are modules. Modules are isolated pieces of code that when put together construct the larger functioning application. Node.js accomplishes this abstraction through the CommonJS standard, which provides a system of using files to encapsulate code and make code available to other files. Through a module system, files can be imported, exported, and plugged into other files to carry out some function in constructing the overall application. Modules also help solve the old issues JavaScript had with code existing within a global scope. …


Lately, as I have been focused on Node.js development, I have spent time learning about the underlying ideas that power the platform. Node.js departs from more traditional methods of handling I/O operations via the usage of threads, accomplishing efficiency and speed with its non-blocking I/O design. This non-blocking design is made possible through asynchronous handling of operations, by utilizing what’s known as an event-driven model. What this means is that at the core, Node.js uses events to set processes in motion and executes and completes them only when they are ready.

An event can be understood as some sort of…


When we think of programming paradigms, the one that receives the most coverage is Object-Oriented Programming. This is to say, a programming paradigm is how code is implemented and executed, and in the case of OOP, it is via the use of classes and objects. However, aside from the OOP paradigm, the functional programming paradigm is one that is gaining popularity, as it is seen extensively within React and other libraries. JavaScript enables such a style because functions can be used as data, and passed around within a program. …


In JavaScript, anything that is not a primitive value such as strings or integers is an object. What this means is that functions are actually objects or at least specialized objects. This also means that functions have access to properties and methods like all other objects do. JavaScript defines built-in properties and methods on functions like the name property which returns the name of the function declaration or the variable name that binds to the function object within function expressions.

function thisFunc() {
...
}
console.log(thisFunc.name) // => thisFunc
const thatFunc = () => ...
console.log(thatFunc.name) // => thatFunc

Included…


To recap my last blog, “Exploring Closures with JavaScript Functions”, to understand closures, it’s essential to remember that functions create an enclosed environment known as a namespace. Namespaces allow you to work with variables that have been defined within other namespaces or scopes without overwriting them. Now here is the critical part, when a function is defined, the function object that is created not only contains the code defined within its code block but also a reference to the namespace it was defined in, and the variable bindings within the namespace.

function outerFunc() {
const outerFuncScope = "outerFunc"…

Continuing with the theme of functions and their many lesser-known features, closures are one of the more important and powerful features to be aware of. In understanding them, we first have to start with the idea of a namespace, which is a space where variables bindings are made. These bindings are protected from any outer bindings that may share the same variable names and risk overwriting the bindings.

// global namespace
let scope = "global"; // first variable binding
if (true) { // if statement namespace
let scope = "local";
console.log(scope); // => local
}
console.log(scope); // => global

In…


In programming, functions are foundational. They modularized logic which creates reusability and cleaner code. Sometimes, functions are able to carry out their logic with outside input known as arguments. Arguments are then used within a function’s body to compute a return value. Functions are able to utilize arguments through function defined local variables called parameters. JavaScript functions also allow many ways to work with parameters and arguments, some of which are not too familiar.

When working with parameters and arguments, the simplest variation is a function that expects a single argument.

function greet(greeting) {
console.log(greeting);
}
greet("hello"); // => hello


In JavaScript, functions are objects which provide a modular way to define a set of procedures or operations that can be used many times within a program. By using functions, code is abstracted away reducing potential repetitive logic and helping to maintain legibility. But when working with functions, it is important to know a few things about them, like the fact that they have access to many values that affect how the function can be used. For example, a common value that functions have access to are parameters, which are used as local variables within the code block of the…


Working with data can take two forms, either some work is done directly to it resulting in the data being fundamentally changed or it can be copied, and then have some work done to the copy. Most, if not all of the time, working with data in an immutable way is the preferred way because it increases the efficiency of being able to follow the flow of data and the changes made to it. For example, the React library uses this concept of maintaining immutability when working with state. The state of a component, or the data that describes the…


Usually when we think of a data structure being iterable, we think of arrays and strings. JavaScript provides many ways to iterate over an array or string, ranging from the standard for-loop to more modern variation like the ES6 for/of loop. However, because objects are not inheritently iterable, JavaScript has defined the for/in loop which is specifically for iterating over objects. The for/in loop iterates over each property name or key in the object, by which then you could access the value. …

Uriel Rodriguez

Flatiron School alumni and Full Stack web developer.

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