JavaScript for beginners - Chapter 23 - Arguments Object to a function - part 1

Опубликовано: 05 Октябрь 2024
на канале: Ankpro Training
184
5

JavaScript Arguments Object :
The javascript arguments object is a local variable available within all functions.
An arguments object includes value of each parameter.
The arguments object is an array like object. You can access its values using index similar to array.
The length property of the arguments object returns the number of arguments passed to the function.
We can pass variable number of arguments to a javascript functions. All the parameters will be stored in the arguments object.
An arguments object is still valid even if function does not include any parameters.
An arguments object can be iterated using for loop.

function ShowMessage(firstName, lastName)
{
alert("Hello " + arguments[0] + " " + arguments[1]);
}

ShowMessage("Steve", "Jobs");

ShowMessage("Bill", "Gates");

ShowMessage(100, 200);

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World