Your Node.js backend is slow? Speed it up by caching responses and start returning them immediately. This will also drastically increase the number of users who can simultaneously access your site. The problem is that the basic approach to caching in Node.js involves spreading read and write caching operations across the business logic. This leads… Continue reading Build a Caching Layer in Node.js With Redis
Category: JavaScript
Best Practices for Securing Node.js Applications in Production
Node.js is one of the favorite technologies for developers when it comes to backend development. Its popularity keeps rising and is now one of the main targets of online attacks. That is why it is crucial to secure Node.js from vulnerabilities and threats. In this guide, you will see the 15 best practices for devising… Continue reading Best Practices for Securing Node.js Applications in Production
Exploring JavaScript Frameworks for Progressive Web Applications (PWAs)
JavaScript has become a cornerstone of modern web development, empowering developers to create dynamic and interactive web applications. With the rise of Progressive Web Applications (PWAs), there’s a growing need for JavaScript frameworks that facilitate the development of fast, reliable, and engaging web experiences. This article delves into various JavaScript frameworks tailored for building PWAs… Continue reading Exploring JavaScript Frameworks for Progressive Web Applications (PWAs)
Learn how to document JavaScript or TypeScript code using JSDoc & Typedoc
In this blog, you’ll learn how to document your JS/TS code, how to give more context to your functionalities using JSDoc, and how to generate documentation files using Typedoc. Setting up the project Create a new project using npm: > npm init -y For this blog, it contains 3 files: src/app.js src/models/user.mjs src/models/todo.mjs Then update… Continue reading Learn how to document JavaScript or TypeScript code using JSDoc & Typedoc
Async vs Defer in JavaScript: Which is Better?
This article will explore an interesting Javascript topic. async and defer are attributes used when including external JavaScript files in HTML documents. They affect how the browser loads and executes the script. Let’s learn about them in detail. Default Behaviour We generally connect our HTML page with external javascript with <script> tag. Traditionally, JavaScript <script> tags were often placed in the <head> section of the… Continue reading Async vs Defer in JavaScript: Which is Better?
How to view the History in VS Code
You can view the change history of the file by navigating to the ‘TIMELINE’ Steps Select your file from the VS Code explorer Go to Timeline Here you can view the all changes. You can redo the changes if needed
JavaScript code to close the current page and reload the parent page after a time delay.
// Set the time delay in milliseconds (e.g., 3000 milliseconds = 3 seconds) const timeDelay = 3000; // Close the current page after the time delay setTimeout(() => window.close(), timeDelay);// Close current page setTimeout(() => window.opener.location.reload(), timeDelay);// Reload the parent page
WebAssembly(WASM) in JavaScript
WASM also known as WebAssembly, was introduced in 2017 as a binary instruction format designed for a stack-based virtual machine. Its primary purpose is to run efficiently within modern web browsers. WASM is a low-level assembly language format that can be compiled from various languages like C++, C#, Rust, and even JavaScript. It acts as a… Continue reading WebAssembly(WASM) in JavaScript
Metaprogramming in Javascript
Metaprogramming develops as a strong paradigm that goes beyond ordinary execution, allowing programmers to change programs as they execute. This allows apps to behave dynamically, produce code fragments at runtime, and even create unique data structures with specific functions. Some important tools in this space are the Reflect API, which makes object manipulation easier, proxies… Continue reading Metaprogramming in Javascript
Sort Array of strings in javascript
The following function can be used to sort an array of strings in descending order. /** * Sort array in descending order * @param {*} arr array to be sorted * @returns sorted array */ function sortDescending(arr) { arr.sort((a,… Continue reading Sort Array of strings in javascript