My Development Notes

Programming Made Easier


Category: JavaScript

  • Stateless API vs Stateful API : Meaning and Usages

    Stateless APIs In case of stateless APIs, each request from a client to the server must contain all the information needed to understand and process the request. The server does not store any session information about the client. Here, each request is independent and the server does not retain any info about previous requests. For…

  • A Floating Slide-In and Slide-Out Container in HTML, CSS and JavaScript with source code

    A Floating Slide-In and Slide-Out Container in HTML, CSS and JavaScript with source code

    Here’s an easy method to create a fully functional slide-in and slide-out container using HTML, CSS and vanilla JavaScript. Below is the source code: This is a floating container. Observe the CSS code syntax below to see how it’s implemented. The class slide-dynamic is created and will be implemented by a JavaScript function.

  • 10 Essential JavaScript concepts to learn for Absolute Beginners

    10 Essential JavaScript concepts to learn for Absolute Beginners

    JavaScript is a very dynamic and versatile programming language that has revolutionised the web development process. It was created by Brendan Eich in 1995. JavaScript adds interactivity to a website by providing ways to manipulate Document Object Model (DOM) in web browsers. Over a period JavaScript has evolved into a full fledged programming language that…

  • Create a button which displays a pop-up and pop-out window using CSS and JavaScript

    Create a button which displays a pop-up and pop-out window using CSS and JavaScript

    We’ll create a button which shows a pop-up and pop-out window when you click on the button. For this we’ll use a JavaScript function which will be linked to the HTML using onClick keyword on the HTML linked to the button. Here’s the code : Next, the code block below, note that the popupWindow() function…

  • Dark Mode Toggle button using HTML, CSS and JavaScript

    Dark Mode Toggle button using HTML, CSS and JavaScript

    Here’s a simple way to create a toggle button to switch between light mode and dark mode using HTML, CSS and JavaScript function. In the above CSS code block, we’ve created the default light mode background for the body. We’ve also created another dark-mode class which will be activated dynamically using the JavaScript function. In…

  • JavaScript Promises using Resolve and Reject

    JavaScript Promises using Resolve and Reject

    JavaScript has a special class called Promise. In order to create a promise, you’ll have to create an instance of the promise class. The promise constructor needs only a single argument which is a function (though you can add two arguments as well). The promise needs to be created with the function. The function is…

  • How to create reusable Header and Footer using JavaScript?

    How to create reusable Header and Footer using JavaScript?

    There are a few different ways to create reusable header or footer in a website using JavaScript so that you don’t have to repeat the code. Let’s explore : Method 1 (using template tag) I’m using an HTML template tag to hold content first. Content inside this tag is hidden by default. You have to…

  • Asynchronous JavaScript, AJAX, APIs and JSON : An Intro

    Asynchronous JavaScript, AJAX, APIs and JSON : An Intro

    In order to understand what Asynchronous JavaScript is, we need to first know what synchronous JavaScript means. Every JS function or code runs in a certain rule of sequence. For example, in order to execute a multi-line code, a first set of instructions is executed just to go to the next step and the next,…

  • Whether a number is odd or even – JavaScript

    Whether a number is odd or even – JavaScript

    Question How to find out whether a number is odd or even using JavaScript code? Solution 1 Solution 2 Note: Here I’ve used the Bitwise AND rule. Refer JavaScript Bitwise AND documentation to know why this works. In the above code, n & 1 returns odd and everything else returns even numbers as per the…

  • How to return highest and lowest numbers from a list in JavaScript?

    How to return highest and lowest numbers from a list in JavaScript?

    Question : We are given a string of space-separated numbers and we need to return the highest and lowest numbers like so: Solution 1 We’ve written a function and first used split since the input numbers are in ‘strings’ format and then map() method to create new array to map through each of them. Next,…