PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 24 · 7 min readNode.js Event Loop Explained ClearlyIntroduction Whenever someone says Node.js is single-threaded, one doubt comes up almost immediately: then how does it handle so many requests at the same time? At first, this sounds a little confusin00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 24 · 6 min readNodeList vs HTMLCollection: Understanding the Real Difference in the DOMIntroduction At some point while learning the DOM, almost everyone runs into this confusion: querySelectorAll() returns one thing, and getElementsByClassName() returns another. But both look like list00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 23 · 3 min readArray Flatten in JavaScriptIntroduction Sometimes an array does not contain direct values only, but other arrays as well. const numbers = [1, [2, 3], [4, 5]]; This is called a nested array. And when we convert it into a simple00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 23 · 2 min readJavaScript Modules: Import and Export ExplainedIntroduction As JavaScript projects grow, one problem appears quickly: keeping all the code in one file becomes messy This is where modules become useful. Why Modules Are Needed If everything is in o00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 23 · 3 min readError Handling in JavaScript: Try, Catch, FinallyIntroduction JavaScript code does not always run perfectly. Sometimes: the wrong variable gets used an invalid value appears an unexpected situation occurs Errors can happen in all of these situa00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 23 · 3 min readAsync/Await in JavaScript: Writing Cleaner Asynchronous CodeIntroduction Promises made asynchronous code better than callbacks. But as the steps increased, .then() chaining could still start to feel a little noisy. This is where async and await become useful. 00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 22 · 7 min read Understanding JavaScript Promises - A Beginner's Real ExperienceWhen I first saw this code: console.log("Start"); setTimeout(() => console.log("Async Task"), 2000); console.log("End"); Output: Start End Async Task My first reaction was, "Okay, there is a 2000ms 00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 22 · 4 min readCallbacks in JavaScript: Why They ExistIntroduction In JavaScript, functions are not just blocks of code that run. We can: store functions pass functions around and call them later This is where the callback concept begins. In simple 00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 22 · 4 min readSynchronous vs Asynchronous JavaScriptIntroduction At some point while learning JavaScript, this question naturally comes up: When does code run line by line, and when does some work happen later? This is where the topic of synchronous an00
PSPrashant Sainiinprashsainidev.hashnode.dev·Apr 21 · 4 min readString Polyfills and Common Interview Methods in JavaScriptIntroduction Strings are very common in JavaScript. We work with them every day: checking text splitting text converting to lowercase or uppercase accessing characters But in interviews and deep00