How to run a function when the page is loaded in JavaScript ?
A function can be executed when the page loads successfully. This can be used for various purposes like checking for cookies or setting the correct version of the page depending on the user’s browser....
read more
Validation of file size while uploading using JavaScript / jQuery
Validation of file size while uploading is important to provide a nice user experience. In this article, we will learn how to implement file size validation by checking file size before uploading using Javascript and jQuery....
read more
JavaScript Converting milliseconds to date
To Convert milliseconds to date You can achieve this using the Date object, In this article we will see how to Convert milliseconds to date....
read more
Binary Search In JavaScript
Binary Search is a searching technique that works on the Divide and Conquer approach. It is used to search for any element in a sorted array. Compared with linear, binary search is much faster with a Time Complexity of O(logN), whereas linear search works in O(N) time complexity...
read more
Debouncing in JavaScript
Debouncing is a technique in programming that helps prevent time-consuming tasks from being triggered so frequently that they slow down the performance of a web page. In simpler terms, it controls how often a function is called....
read more
What is export default in JavaScript ?
The export statement is used when creating JavaScript modules to export objects, functions, and variables from the module so they can be used by other programs with the help of the import statements. There are two types of exports. One is Named Exports and the other is Default Exports....
read more
How to store a key=> value array in JavaScript ?
We have given two arrays containing keys and values and the task is to store it as a single entity in the form key => value in JavaScript. In JavaScript, the array is a single variable that is used to store different elements. It is usually used once we need to store a list of parts and access them by one variable. We can store key => value array in JavaScript Object using methods discussed below:...
read more
How to remove spaces from a string using JavaScript?
We will explore how to remove spaces from a string using JavaScript. We’ll take a string as input and then remove all the spaces present in it, returning the resulting string....
read more
How does inline JavaScript work with HTML ?
You can include inline JavaScript directly within the HTML body using the <script> tag. Unlike linking an external JavaScript file with the src attribute, inline JavaScript is written directly within the <script> tags. This method allows for quick implementation of JavaScript functionalities within specific HTML elements or sections of a webpage....
read more
How to get the first key name of a JavaScript object ?
Given an object and the task is to get the first key of a JavaScript Object. Since a JavaScript object does not contains numbered index so we use the following approaches to get the first key name of the object....
read more
JSON web token | JWT
A JSON web token(JWT) is JSON Object which is used to securely transfer information over the web(between two parties). It can be used for an authentication system and can also be used for information exchange.The token is mainly composed of header, payload, signature. These three parts are separated by dots(.). JWT defines the structure of information we are sending from one party to the another, and it comes in two forms – Serialized, Deserialized. The Serialized approach is mainly used to transfer the data through the network with each request and response. While the deserialized approach is used to read and write data to the web token....
read more
JavaScript addEventListener() with Examples
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. This method allows multiple event handlers on an element, enabling dynamic and flexible interaction management within web applications....
read more