How to Remove an Object's Property in JavaScript Without Mutation

Hiiiiiii there, today I will be sharing a useful JavaScript Tip which you can use to avoid Mutation when dealing with objects. To mutate something is to change it; it is to alter its form. Deleting an Object’s property is Mutation Say you have a user object defined like this: const user = { firstName: 'John', lastName: 'Obajeti', gender: 'Male', password: 'safest' } Assuming you need to send this object as part of an API Response, you will want to remove the password field. You can do this by using the delete keyword: ...

March 11, 2022

Why Do We Need Strict Mode in JavaScript?

If you have been in the Web Tech space for some time, you are most likely familiar with the banter JavaScript gets. It seems to be the most ‘mocked’ programming language yet a lot of people use it. The reason for this banter is not far-fetched, in many ways JavaScript can be surprising. Some actions that will break programs in other programming languages will run successfully in JavaScript. For example, every programming language has reserved words that should not be used as variable names and should not be overridden. An example is the undefined keyword in JavaScript, it’s a reserved keyword but the following code snippet will run without error in JavaScript: ...

March 9, 2022

JS Tip: How to Shuffle An Array in JavaScript

Hi there, today I will be sharing a tip on shuffling an array in JavaScript. The algorithm we will come up with can actually be implemented in any programming language but I will be doing it in JavaScript. Input Say we are given an array of a primitive type in JavaScript e.g [1, 3, 4, 5, 6, 2] or ["Tom", "Jerry", "Parker", "Wick"] Output The output is an array that contains the same elements as the first array but the order of those elements have been randomized ...

March 8, 2022

A Brief History of HTTP for Web Developers

Let me tell you a secret. I have been interacting with the web for a very long time and I am still fascinated by it today. I used to be just a consumer of the web but now I build things for it too and it’s even more fascinating. How does it work? How can a website visit a URL and then display a web page? Since computers understand only ones and zeros, how then is it possible to upload my pictures and graphics on Instagram? ...

March 7, 2022

JavaScript Prototypes in Plain English

*Cover Image by Jozef Mikulcik from Pixabay * One of the concepts in JavaScript that beginners find hard to wrap their heads around is prototypes, especially for Programmers coming from a class-based programming language. You might ask “Doesn’t modern JavaScript have the class keyword?” Yes, it does, but it’s just ‘sugar’ over prototypes, and understanding how prototypes work can save you a lot of stress when debugging JavaScript code. JavaScript is weird but understanding it makes it less weird in my opinion (if you trust that my opinion matters :) ) ...

October 22, 2021

Understanding Mixins: From Ice Cream Stands to TypeScript

When Steve Herell opened his first Ice Cream store, instead of having pre-mixed flavors, he had his staff mix freshly made ice cream with candy or other confections based on the customer requests. Those candy additions were called mix-ins. Steve probably only wanted to beat the competition, he didn’t know that his mix-in would find its way into Computer Programming Languages years later, though not literally - we don’t conjure ice creams with code yet. Do we, is there something you people are hiding from me? ...

January 23, 2021

Learn How to Create Chainable Methods in Javascript With a Practical Example

Chaining is a cool concept in programming, it is calling a method on a returned object without reassigning the value first. Suppose you have a users object: const users = [ {fname: 'Joseph', lname: 'Ada', age: 12}, {fname: 'Bernard', lname: 'Rutsell', age: 81}, {fname: 'Thompson', lname: 'Josaih', age: 41}, {fname: 'Dayo', lname: 'Adeoye', age: 17} ] And your task is to filter out users that are 18 and above. We can do this with the following lines of code which doesn’t use method chaining: ...

January 22, 2020

What Exactly is Node.js? (Keeping it awesomely simple)

Node.js has grown from it humble beginnings in 2009 to one of the most popular platforms for creating web applications. If you have been around web development for a while, you would have heard people say, ‘node is just javascript’. That’s true, to appreciate node.js, it would help to know what it came to solve and why it is used. Anatomy of a Web Application Image courtesy of Medium.com ...

January 4, 2020

A Common Sense Explanation of JavaScript Array Methods

The array methods filter, map, reduce have been around for a while and they make working with arrays easier. But sometimes it is hard for new JavaScript developers to determine which of the array methods they need to use. In this post, I will give a simple explanation of the aforementioned array methods. After going through this post, choosing which one to use will be a piece of cake. ...

November 1, 2019

Build an 8 Puzzle Game With Pure JavaScript

Hey yo! In this post we are going to be creating a game with basic web design skills. All you need is basic knowledge of html, css and JavaScript. The game we are making is the popular 8 Puzzle Game. It is made of 9 tiles with 8 of them filled up with contents and the last one is empty. To solve the puzzle, the player will have to rearrange the tiles. ...

September 20, 2019