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

How to handle errors in Express and Node.js App

Image by mohamed Hassan from Pixabay When we create api’s with express, we define some routes and their handlers, in an ideal world, consumers of our api will only make requests to routes that we defined and our routes will work without error. But if you have noticed, we do not live in an ideal world :). Express knows this and it makes handling errors in our api’s a breeze. In this post I will explain how to handle errors in express, to follow along please clone the repository here. ...

January 10, 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