Articles on Trending Technologies

Technical articles with clear explanations and examples

How to call a parent window function from an iframe using JavaScript?

Paul Richard
Paul Richard
Updated on 15-Mar-2026 4K+ Views

When working with iframes, you often need to call functions defined in the parent window from within the iframe. JavaScript provides several methods to achieve this cross-frame communication. Using window.parent The most common approach is using window.parent to reference the parent window: Parent Window Parent Window function displayMessage(message) { ...

Read More

How to use unlimited arguments in a JavaScript function?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

In JavaScript, functions typically accept a fixed number of parameters, but there are several ways to handle an unlimited number of arguments. This tutorial explores three methods to pass and process multiple arguments in JavaScript functions. Using ES5 Arguments Object The arguments object is available in all non-arrow functions and contains all arguments passed to the function, regardless of how many parameters are defined. Syntax function functionName(param1, param2) { var actualParams = functionName.length; // Number of defined parameters var totalArgs = arguments.length; ...

Read More

How can I declare optional function parameters in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 11K+ Views

This tutorial will teach us how to declare optional function parameters in JavaScript. While declaring the function, we pass some variables to the function definition to use it inside the function block, called function parameters. The function parameters can also be optional, which gives us the independence to pass function arguments when we call the function. Here, Arguments are the values we pass while calling the function, and parameters are the variables we pass in the function definition. What Are Optional Parameters? The optional parameter word means that you don't need to pass that parameter every time ...

Read More

What is Multiplication Assignment Operator (*=) in JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 740 Views

The multiplication assignment operator (*=) in JavaScript provides a shorthand way to multiply a variable by a value and assign the result back to the variable. Instead of writing a = a * b, you can simply use a *= b. Syntax operand1 *= operand2 // equivalent to: operand1 = operand1 * operand2 The multiplication assignment operator is a binary operator that multiplies the left operand by the right operand and stores the result in the left operand. Example 1: Basic Usage with Numbers Here's how the multiplication assignment operator works with numeric ...

Read More

How to delay a JavaScript function call using JavaScript?

Prince Varshney
Prince Varshney
Updated on 15-Mar-2026 97K+ Views

In this tutorial, we are going to learn how can we delay a function in JavaScript. Whenever we want to call a function after a specified amount of time than we use the delay function in JavaScript. To provide delay in JavaScript function we use a global window object named as setTimeout(). This function allows us to provide a specific delay before executing a function. The setTimeout() method mainly requires two arguments: the function which we need to execute with some delay and the time (in milliseconds) for which we want to delay the function. Syntax ...

Read More

How to use associative array/hashing in JavaScript?

Abhishek Kumar
Abhishek Kumar
Updated on 15-Mar-2026 675 Views

We use Object and Map classes to mimic the behavior of associative array/hashing in JavaScript. JavaScript doesn't provide an associative array built-in. The closest similar behavior we get is from the Map class in JavaScript. Let us look at them one by one. Object Class in JavaScript The object class allows us to create objects with name-value pairs. This is similar to hashing as the object knows which property is associated with what value. Syntax const obj = { name : "Abhishek", age : 22 } var name ...

Read More

How to encode a URL using JavaScript function?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

As we know, a URL is a web address. What is URL encoding and why do we need to encode a URL? The process of turning a string into an accurate URL format is known as URL encoding. A valid URL format only uses "alpha | digit | safe | extra | escape" characters. Only a limited selection of the normal 128 ASCII characters is permitted in URLs. Reserved characters that are not part of this set must be encoded. URL encoding increases the reliability and security of URLs. Each character that needs to be URL-encoded is encoded ...

Read More

How to decode a URL using JavaScript function?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 1K+ Views

In this tutorial, we will learn how to decode a URL using JavaScript. URL is an abbreviation for Uniform Resource Locator. A URL is the address of a certain Web site. Each valid URL, in principle, links to a different resource. These resources include an HTML page, a CSS document, a picture, etc. URL encoding refers to replacing certain characters in a URL with one or more character triplets composed of the percent character "%" followed by two hexadecimal numbers. The triplet's two hexadecimal digits represent the numeric value of the replacement character. URL encoding's reverse process is ...

Read More

How to add a number of months to a date using JavaScript?

Paul Richard
Paul Richard
Updated on 15-Mar-2026 841 Views

To add a number of months to a date in JavaScript, you can use the setMonth() method combined with getMonth(). This approach automatically handles year transitions and varying month lengths. Basic Syntax date.setMonth(date.getMonth() + numberOfMonths); Example: Adding Months to Current Date var currentDate = new Date(); var monthsToAdd = 3; document.write("Original Date: ...

Read More

How to parse JSON object in JavaScript?

Vikyath Ram
Vikyath Ram
Updated on 15-Mar-2026 751 Views

JSON (JavaScript Object Notation) is a lightweight data format commonly used for data exchange. JavaScript provides the built-in JSON.parse() method to convert JSON strings into JavaScript objects. Syntax JSON.parse(text, reviver) Parameters text - The JSON string to parse reviver (optional) - A function that transforms the results Basic JSON Parsing Example // Simple JSON string let jsonString = '{"name": "John", "age": 30, "city": "New ...

Read More
Showing 19081–19090 of 61,297 articles
Advertisements