When setting up Babel in modern JavaScript projects, many developers resort to copying configurations from online examples without fully understanding what each option does. This often leads to issues like white screens on older mobile browsers or unnecessarily large bundle sizes. To avoid these pit...
Block Scoping with let and const The var keyword suffers from function‑scoped hoisting that can cause unexpected bugs. let and const offer true block scoping and prevent access before declaration – the temporal dead zone. const blocks reassignment but still allows property mutations. let userName =...
Getting Started Drop Vue into any page via CDN: <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> Create a mount point and an instance: <div id="root"> <h1>{{ heading }}</h1> </div> <script> new Vue({ el: '#root', dat...
JavaScript Essentials JavaScript provides built-in modules through DOM and BOM APIs, while libraries like jQuery serve as external modules. Variable Declarations var counter; // Function-scoped variable let playerName = "Genshin"; // Block-scoped variable const GRAVITY = 9.8; // Immutable...
Understanding Prototypes in JavaScript When we create a class using a constructor function, memory pre-allocates an object caled the prototype object. The constructor function has a prototype property pointing to this object, and the prototype object has a constructor property pointing back to the c...
When working on a project that required retrieving the current page number from an embedded PDF viewer, I encountered several obstacles that took considerable time to resolve. This article documents the challenges I faced and the solutions I eventually implemented. Initial Setup The PDF viewer was h...
Nested Destructurnig in React When working with React comopnents, you'll frequently encounter destructuring assignment syntax throughout React codebases. This language feature was introduced in ES6 (ECMAScript 2015), but its usage is partciularly prevalent in React development. Interpreting Complex...
iterate: Sequential Value Transformation Usage Executes a transformation function repeatedly over a specified number of steps, carrying forward an accumulator value. Example import { iterate } from 'radash' const total = iterate( 5, (accumulator, step) => accumulator + step * 2, 0 ) // Result: 30...
Handling Cookies When making same-origin requests, both fetch and axios automatically include cookies. For cross-origin scenarios, however, different configurations are required: Fetch: You must explicitly set the credentials option to 'include' in the configuration object. Axios: You must set withC...
Block-Level Scoping with let Before ECMAScript 6, JavaScript lacked block-level scope. Variables declared with var inside blocks remained accessible outside them: { var score = 95; } console.log(score); // 95 The let keyword introduced true block scoping: { let score = 95; } console.log(score); // R...