| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Functions/arguments | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.
* Some parts of this feature may have varying levels of support.
arguments Array .
function func1(a, b, c) {
console.log(arguments[0]);
// Expected output: 1
console.log(arguments[1]);
// Expected output: 2
console.log(arguments[2]);
// Expected output: 3
}
func1(1, 2, 3);
arguments
arguments . arguments , . 0 .
, .
arguments[0];
arguments[1];
arguments[2];
.
arguments[1] = "new value";
arguments Array . Array , length pop() Array . Array :
var args = Array.prototype.slice.call(arguments);
var args = [].slice.call(arguments);
arguments Array ES2015 Array.from() .
var args = Array.from(arguments);
var args = [...arguments];
arguments . . arguments.length , arguments . signature , Function.length .
arguments.callee.
arguments.caller .
arguments.length.
arguments[@@iterator]arguments Array Iterator .
. . :
function myConcat(separator) {
var args = Array.prototype.slice.call(arguments, 1);
return args.join(separator);
}
.
// "red, orange, blue"
myConcat(", ", "red", "orange", "blue");
// "elephant; giraffe; lion; cheetah"
myConcat("; ", "elephant", "giraffe", "lion", "cheetah");
// "sage. basil. oregano. pepper. parsley"
myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");
HTML . (bulluet( ) ) "u" ( ) "o" . :
function list(type) {
var result = "<" + type + "l><li>";
var args = Array.prototype.slice.call(arguments, 1);
result += args.join("</li><li>");
result += "</li></" + type + "l>"; // end list
return result;
}
, . :
var listHTML = list("u", "One", "Two", "Three");
/* listHTML:
"<ul><li>One</li><li>Two</li><li>Three</li></ul>"
*/
function foo(...args) {
return arguments;
}
foo(1, 2, 3); // { "0": 1, "1": 2, "2": 3 }
, mapped arguments , . , , 100 10 :
function bar(a = 1) {
arguments[0] = 100;
return a;
}
bar(10); // 10
function zoo(a) {
arguments[0] = 100;
return a;
}
zoo(10); // 100
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-arguments-exotic-objects |
This page was last modified on 2025 6 27 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |