Error Handling without the Result Class

Purposefully throwing errors can have several negative side effects to the readability and traceability of your code. In this article, we take a look at an alternative to how to handle errors within your Node.js + TypeScript applications. Do you ever find yourself wondering where exactly you should throw an error to be consumed by… Continue reading Error Handling without the Result Class

ECMAScript 2024 features you can use now

ECMAScript 2024 is expected to be finalized in June, but four new JavaScript features are already supported in browsers and Node.js. Here’s how to start using them today. The ECMAScript specification is like a portrait of the JavaScript language that is repainted every year. As is typical of modern JavaScript, the spec and real-world practice move… Continue reading ECMAScript 2024 features you can use now

5 ways to use JavaScript promises

Developers use JavaScript promises to model asynchronous operations in web and server-side programs. Here’s a quick look at five ways to use promises in your code. Promises are a central mechanism for handling asynchronous code in JavaScript. You will find them in many JavaScript libraries and frameworks, where they’re used to manage the results of an… Continue reading 5 ways to use JavaScript promises

Usage of Link Component in Next Js

<Link> is a React component that extends the HTML <a> element to provide prefetching and client-side navigation between routes. It is the primary way to navigate between routes in Next.js. import Link from ‘next/link’ function Home() { return ( <ul> <li> <Link href=”/”>Home</Link> </li> <li> <Link href=”/about”>About Us</Link> </li> <li> <Link href=”/blog/hello-world”>Blog Post</Link> </li> </ul> )} export default Home

How to Create a Step Progress Bar With Tailwind

The very first thing we need is the HTML structure. index.html <div class=”stepper-wrapper”> <div class=”stepper-item completed”> <div class=”step-counter”>1</div> <div class=”step-name”>First</div> </div> <div class=”stepper-item completed”> <div class=”step-counter”>2</div> <div class=”step-name”>Second</div> </div> <div class=”stepper-item active”> <div class=”step-counter”>3</div> <div class=”step-name”>Third</div> </div> <div class=”stepper-item”> <div class=”step-counter”>4</div> <div class=”step-name”>Forth</div> </div> </div> We have a wrapper that contains all of the steps.… Continue reading How to Create a Step Progress Bar With Tailwind

Identify digits within a string

function extractDigits(text) { var regex = /bd+b/g; var matches = text.match(regex); return matches ? matches : []; } // Usage var text = “Order numbers: 123, 456 and 789.”; var digits = extractDigits(text); console.log(digits); // Output: [“123”, “456”, “789”] Explanation /bd+b/g: The regex pattern to match standalone digits. b: Word boundary to ensure digits are… Continue reading Identify digits within a string

Optional Chaining Operator(?.)

What happens when we deal with – Data — Easy to traverse. Nested Data — Little difficult to traverse. More levels of Nesting in Data — Painful to traverse; More lines of code. Ahhh…. too much work ???😰 Hang in there. OPTIONAL CHAINING to your rescue !!! Optional Chaining operator has been introduced in JavaScript now and is… Continue reading Optional Chaining Operator(?.)

Callback Hell

Callbacks A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete its action. They’re so common in JavaScript that you probably have used callbacks yourself without knowing that they’re called callbacks. A very simple example of the callback is: const numbers =… Continue reading Callback Hell

Memoization it is!

In computing, memoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. – sources: Wikipedia. In a simpler words, Memoization is nothing but caching or storing the results in a memory. Without Memoization Fibonacci is the best example to illustrate the memoization… Continue reading Memoization it is!