How to Use Enums in JavaScript? Defining a Custom Object

If you come from a Typescript background or any other languages like C++, Python, etc., you must have come across Enums. Although “enum” is a reserved keyword in Javascript, Enums don’t really exist in Javascript, but you can “kind of” create them yourself, as you will learn in this post. An enum is a short … Read more

(Solved) Cannot Convert Undefined or Null to Object in JS

The error “TypeError: Cannot convert undefined or null to object” happens when JavaScript attempts to convert null and undefined to an object. Below you can see examples of when this error occurs. In the previous example, notice how the Object.assign() , Object.keys() , and Object.values() methods expect a parameter o equivalent to any JavaScript object … Read more

JavaScript Higher-Order Functions: A Guide with Examples

Functions are one of the fundamental building blocks in Javascript. A function is a set of statements that perform a task or calculate a value. They come in handy as they simplify our program’s structure, readability, and reusability by abstracting the implementation of a particular algorithm. As a functional language, Javascript supports the concept of … Read more

A Complete Guide to JavaScript Currying: What Does it Mean?

Functional programming in Javascript allows you to pass a function as an argument and return a function. This programming style introduces you to several concepts you would also encounter in other programming languages like Python, Erlang, Scala, and many more. They include: Function currying Pure and Impure functions High order functions We already did a … Read more

A Complete Guide to Pure and Impure Functions in JavaScript

There are two popular terms you will encounter when working with functional programming in Javascript – Pure and Impure functions. It’s also a common topic you will likely come across in most Javascript interviews. On the surface level, the two might look quite similar. However, it would be best to have an in-depth understanding as … Read more

Difference Between package.json and package-lock.json

When working on a project that utilizes NPM, you will find two files in your project root folder – the package.json file and the package-lock.json file. Most developers take note of only the former (package.json) since it’s where they write the scripts to start an application. However, what is the purpose of the two files? … Read more

The Complete Guide To JavaScript Promises (Explained)

When working with Async javascript, there are three main methods that you will interact with, namely Callbacks, Async/Await, and Promises. This post will focus on the latter – Promises in javascript. Promises are a powerful feature in asynchronous Javascript, and there is a high chance that you will be asked a question regarding Promises in … Read more

JavaScript | Complete Guide to Understanding “This” Keyword

Javascript is becoming more popular for building web applications and mobile apps using React Native framework. Therefore, understanding its key concepts can come in quite handy. The “this” keyword in Javascript is a source of confusion and misery for most beginner Javascript developers and even pro-developers. This post aims to give you a beginner-friendly comprehensive … Read more