Rushi Javiya

Rushi Javiya

137 Articles Published

Articles by Rushi Javiya

Page 5 of 14

Explore the concept of JavaScript Function Scope and different types of JavaScript Functions

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 960 Views

In JavaScript, various scopes allow us to access the functions and variables from different places in our code. We will learn about the function scope in this tutorial. Also, we will explore the different types of function expressions in JavaScript. Function Scope When we create a new function in JavaScript, it also creates the scope for that particular function. It means that whatever variables we declare inside the function or define the nested function inside it, we can only access it inside the function block. If we try to access the variables defined inside the function block ...

Read More

Extract unique objects by attribute from an array of objects in JavaScript

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 7K+ Views

We will learn to extract unique objects by attribute from an array of objects in this tutorial. Sometimes, we need to filter objects from the array of objects based on a particular attribute. For example, we have an id as a key to identify the object. So, we need to ensure that the array contains only a single object with a single id. If two or more objects contain the same primary key value, it can cause the problem of uniquely identifying objects. Here, we will learn different approaches to filter all unique objects from the array based ...

Read More

How to Check Mentioned File Exists or not using JavaScript/jQuery?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 7K+ Views

Using JavaScript or jQuery, we can check whether a file exists and retrieve metadata about the file, such as its size, content type, last modified date, etc., without retrieving the actual file. The HTTP HEAD request is used in this case. An HTTP HEAD request is a type of HTTP request that asks the server to return the HTTP headers for a specified resource without the actual resource itself. Several methods can be used to send an HTTP HEAD request, but the most popular way is to use the $.ajax() method and XMLHttpRequest object. Users can define the request ...

Read More

How to check the type of a variable or object in JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 12K+ Views

JavaScript is a loosely typed programming language, meaning there is no such rule to declare the variable type. A variable can store multiple data types in a program, so it is essential to understand the variable type before using it. In JavaScript, we can use the typeof operator to check the type of a variable or object. The typeof operator takes a variable and returns its type in a string format. In addition to the typeof operator, JavaScript also provides the instanceof operator to check the type of a variable or object. The instanceof operator accepts two arguments: the ...

Read More

How to check whether the background image is loaded or not using JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 2K+ Views

In web development, checking whether a background image has loaded is crucial for ensuring proper page display and user experience. JavaScript provides several methods to detect when images finish loading, allowing developers to take appropriate actions or display fallback content. When dealing with background images, we can use the Image object in JavaScript to monitor loading status. This approach works by creating an image element programmatically and listening for load events, even when the image is used as a CSS background. Methods to Check Image Loading Status Using the onload event handler ...

Read More

How to clear cache memory using JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 36K+ Views

Cache memory, often known as cache, is a different memory system in a computer that stores frequently used data and instructions for a short period. While loading a website, the browser we are using will automatically cache some resources, such as images, scripts, and stylesheets, to be utilized again when the page is reloaded. This can shorten the time it takes for a website to load not only that but also it helps to lower the amount of data that has to be sent over the network. But this cache memory stored by the browser also has some disadvantages. If ...

Read More

Explain non-boolean value coercion to a boolean one in JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 571 Views

We will learn non-boolean value coercion to a Boolean one in JavaScript. For beginners, coercion word is new in JavaScript. So, let's clarify what coercion is. Coercion is converting the variable of one data type to another data type. As we all know, JavaScript is not a type-strict language. So, we don't need to define the types of the variable. Sometimes, JavaScript automatically coerces the variables and gives unpredictable results in the output. There are two types of coercion in JavaScript. One is implicit coercion, and another is explicit coercion. We will learn both coercion one by one ...

Read More

Explain Passport in Node.js?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 2K+ Views

Passport is a popular Node.js authentication middleware that provides flexible authentication strategies. It handles user authentication, password encryption, and session management with minimal code complexity. Passport offers over 500 authentication strategies including local authentication, OAuth (Google, Facebook), JWT tokens, and more. It integrates seamlessly with Express.js and popular databases like MongoDB. Key Features Authentication Strategies: Passport supports multiple authentication methods through strategy plugins. The most common is passport-local for username/password authentication. Password Security: Automatically handles password hashing and verification using secure algorithms, protecting user credentials from being stored in plain text. Session Management: Maintains user ...

Read More

Explain Popup Message using Event?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 977 Views

We can show popup messages to app users using JavaScript popup boxes. There are three different types of popup boxes available in JavaScript that trigger through events like button clicks. The three types of popup boxes are: Alert box - Shows a simple message Confirm box - Asks for user confirmation Prompt box - Collects user input Let's explore each popup type with event-driven examples. Alert Box The alert box displays a simple message to users. It's commonly used for notifications like "Login successful" ...

Read More

Explain Promise.any() with async-await in JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 969 Views

We will learn about the Promise.any() method in JavaScript and how to use it with async/await. In JavaScript, promises handle asynchronous operations, making applications faster by allowing code execution without waiting for slow operations to complete. What is Promise.any()? The Promise.any() method returns the first successfully resolved promise from an array of promises. It ignores rejected promises and only fails if all promises are rejected (throwing an AggregateError). Syntax Promise.any(iterable) .then(value => { // Handle first resolved value }) .catch(error => { ...

Read More
Showing 41–50 of 137 articles
« Prev 1 3 4 5 6 7 14 Next »
Advertisements