File Type Validation while Uploading it using JavaScript
In this article, we will learn how to implement file type validation by checking file extension before uploading it using Javascript. This is a demonstration of client-side validation and is implemented to provide a nice user experience. In some cases, client-side validation is a much better method in comparison to the server-side method as it consumes less time....
read more
How to wait for a promise to finish before returning the variable of a function ?
Here a promise is a returned object from an asynchronous function, and callback methods can be added based on the previous function’s result. It is done for back-to-back execution of functions acting like a queue or chain of functions. So as the functions are in the queue, the functions following it must wait for the previous function’s result....
read more
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