Tuesday, November 23, 2021

How to Mock an API using JSON Placeholder

Public JSONPlaceholder API

JSONPlaceholder is a free, open-source mock REST API service offering realistic example data (including users, posts, comments, todos, and more) for prototyping and testing front-end applications—no sign-up or backend needed. It supports standard HTTP methods, though only GET requests return persistent data.

Saturday, September 4, 2021

Semantic Versioning

What is Semantic Versioning?

Semantic Versioning uses the format major.minor.patch:

  • MAJOR version for incompatible API changes
  • MINOR version for added backward-compatible functionality
  • PATCH version for backward-compatible bug fixes

How npm Uses Semantic Versioning

In package.json, dependency ranges control allowed updates:

  • Patch-level: "~1.2.3" or "1.2.x" → versions ≥1.2.3 <1.3.0
  • Minor-level: "^1.2.3" or "1.x" → versions <2.0.0
  • Major-level: "*" or "x" → any version

Monday, June 21, 2021

Exporting and Importing JavaScript Modules are a Game changer!!


JavaScript modules allow you to break your code into smaller, reusable pieces. This helps keep your code organized, maintainable, and easy to understand. The module system, introduced with ES6, uses the export and import keywords to share and reuse code across different files.


Exporting JavaScript Modules

There are two main ways to export code from a module: named exports and default exports.

Wednesday, March 10, 2021

Understanding JavaScript Promises: A Guide to Asynchronous Programming

JavaScript has evolved over the years to support asynchronous programming, allowing us to handle tasks like API calls, file reading, and timers without blocking the main thread. One of the most important tools for handling asynchronous operations in JavaScript is the Promise. In this post, we'll break down what a JavaScript Promise is, how to use it, and some common patterns that make asynchronous programming more manageable.

Tuesday, January 19, 2021

How to Use a Callback Function in JavaScript



A callback is a function passed as an argument to another function, which is then called inside the outer function. It's a common pattern for asynchronous programming, event handling, and customizing behavior.