---
title: "arguments"
author: "j357777842"
date: "2007-12-26T11:52:50Z"
tags: []
slug: "arguments"
draft: false
lastmod: "2007-12-26T11:52:50Z"
id: 150905
url: "https://herhun.iteye.com/blog/150905"
---

在函数代码中,使用特殊对象arguments,我们在定义函数时,无需指定函数形参,也能访问实参,如下:
function fn(){
    alert(arguments);
}

fn("dd");
则打印出"dd";

arguments对象有个属性length,用来检测传递进来的参数个数,

function fn(){
    alert(arguments.length);
}