2.2K Followers
·
Follow

Extending the Error class

Image for post
Image for post
Photo by Romson Preechawit on Unsplash.

It is important to keep in consideration the different scenarios in which errors could occur while writing your code. They play an integral part in your web application because you can avoid deadly scenarios (like your application crashing completely) that would otherwise not have been avoided if left unhandled.

This article will go over some best practices for controlling errors and handling them in JavaScript.

Extending the Error

It’s often useful to provide a more descriptive error inside your error handlers. And by this, I don’t just mean writing your error message clearer. What I’m referring to is to extend the Error class.

By doing this, you can customize the name and message property that will be useful for debugging as well as attach custom getters, setters, and methods that need…


Functions and composability

Image for post
Image for post
Photo by Shahadat Rahman on Unsplash

JavaScript is widely known for being extremely flexible by its nature. This article will show some examples of taking advantage of this by working with functions.

Since functions can be passed around anywhere, we can pass them into the arguments of functions.

My first hands-on experience with anything having to do with programming in general was getting started with writing code in JavaScript, and one concept in practice that was confusing to me was passing functions into other functions. …


Better composition

Image for post
Image for post
Photo by Luca Bravo on Unsplash

JavaScript is praised for its unique ability to compose and create functions. That’s because in JavaScript, functions are first-class citizens, meaning they can be treated as values and have all of the operational properties that others have (like being able to be assigned to a variable, being passed around as a function argument, or being returned from a function, etc.).

We’ll be going over five critical tips to compose event handlers in React. This article won’t cover everything that’s possible, but it’ll cover important ways to compose event handlers that every React developer should know at a minimum.

We’re going to start with an input element and attach a value and onChange prop to start…

About

jsmanifest

Team Lead Front End Developer for TeleMedicine. Follow and Join Me on my Adventures. https://jsmanifest.com

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