Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. Argument

Argument

Arguments arevalues (primitive orobject) passed as input to afunction. Do not confuse arguments withparameters, which are the names used in the function definition to refer to the arguments.

For example:

js
const argument1 = "Web";const argument2 = "Development";example(argument1, argument2); // passing two arguments// This function takes two valuesfunction example(parameter1, parameter2) {  console.log(parameter1); // Output = "Web"  console.log(parameter2); // Output = "Development"}

The argument order within the function call should be the same as the parameters order in the function definition.

js
const argument1 = "foo";const argument2 = [1, 2, 3];example(argument1, argument2); // passing two arguments// This function takes a single value, so the second argument passed is ignoredfunction example(parameter) {  console.log(parameter); // Output = foo}

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp