Ever noticed a webpage freezing during a heavy task? This happens because JavaScript runs on a single thread by default, causing a bad user experience. Users can’t interact and have to wait until the task finishes. This problem can be solved using web workers. In this article, we will discuss what web workers are, why… Continue reading How web worker works with a practical example
Category: JavaScript
The Clean Code Handbook: How to Write Better Code for Agile Software Development
Building scalable software applications requires writing clean code that’s so simple that any dev can understand it. In this article, I’ll explain and demonstrate what clean code is. Then I’ll share my favorite clean code patterns for building modern Agile applications. I won’t use complex jargon. I’ll hit you with simple, clear JavaScript examples that… Continue reading The Clean Code Handbook: How to Write Better Code for Agile Software Development
Clean Code in JavaScript: A Comprehensive Guide 🚀
What is Clean Code? Clean code is code that is: Readable: Easy to understand at a glance Maintainable: Simple to modify and debug Reusable: Can be repurposed for different scenarios Testable: Easy to write unit tests for Scalable: Can grow without becoming complex 1. Variables: The Building Blocks of Clean Code – Use Meaningful Variable… Continue reading Clean Code in JavaScript: A Comprehensive Guide 🚀
Javascript function that makes easier to replace multiple occurrences of a substring.
replaceAll() makes it easier to replace multiple occurrences of a substring. const signal = “Batman! Batman must respond!”; console.log(signal.replaceAll(“Batman”, “Bruce”)); // “Bruce! Bruce must respond!”
Javascript statement allows shorthand access to an object’s properties
The with statement allows shorthand access to an object’s properties but is generally discouraged due to ambiguity in scope. const obj = { name: “Bruce”, city: “Gotham” }; with (obj) { console.log(name, city); // “Bruce Gotham” }
Use primevue library in single html script that use vue cdn
Add the below script tags <script src=”https://unpkg.com/primevue/umd/primevue.min.js”></script> <script src=”https://unpkg.com/@primevue/themes/umd/aura.min.js”></script> Add the necessary primevue component in the script as shown below const app = createApp({ // rest code }) app.use(PrimeVue.Config, { theme: { preset: PrimeVue.Themes.Aura, options: { … Continue reading Use primevue library in single html script that use vue cdn
Understanding Recursion in JavaScript
Recursion is a powerful programming technique where a function calls itself to solve a problem. In JavaScript, recursion is particularly useful for tasks that involve repetitive subproblems, such as traversing nested structures or implementing mathematical computations. This article explores the concept of recursion, its types, and practical use cases in JavaScript. What is Recursion? Recursion… Continue reading Understanding Recursion in JavaScript
Understanding MutationObserver in JavaScript
In modern web development, manipulating the DOM (Document Object Model) is a common task. While traditional methods like getElementById() or querySelector() can change the content of a web page, sometimes we need a way to observe changes to the DOM without constantly polling or checking for updates manually. This is where the MutationObserver API comes… Continue reading Understanding MutationObserver in JavaScript
Troubleshooting Clickable Area Issues Due to Overlapping Z-Index
When working with web development, one of the most common issues you may encounter is a clickable area that becomes unresponsive or behaves unexpectedly. This often occurs when an element, such as a button or link, is blocked by another element that appears visually above it due to CSS stacking context, particularly related to the… Continue reading Troubleshooting Clickable Area Issues Due to Overlapping Z-Index
Object with key value pair to Array
const RECEPIENTS = { ‘chris’: 21661, ‘sam’: 21628, ‘danna’: 21629, ‘anil’: 3, ‘danny’: 21633, ‘ahap’: ‘aha-shipping@airportapplaincehelp.zendesk.com’, ‘fernanda’: 86081, ‘laura’: ‘laura.martinez@airportappliance.com’, … Continue reading Object with key value pair to Array