---
title: "javascript的函数参数arguments 并不是数组"
author: "413899327"
date: "2013-03-22T12:34:24Z"
tags: []
categories: ["Web前端"]
slug: "javascript-arguments"
draft: false
lastmod: "2013-03-22T12:34:24Z"
id: 1833987
url: "https://rogerfederer.iteye.com/blog/1833987"
---

<span style="color:red">arguments 并不是数组,只是碰巧用数字做索引,以及一个length属性,
getDocumentsByTagName(xxxx)获取的也不是数组，只是元素集合而已！

</span>

```java

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>arguments 并不是数组</title>
<script type="text/javascript">
 
function testArgumentsConstructor(parame1,param2,param3,param4){
	var arr= [];
	alert(arguments.constructor + " \r\n" + arr.constructor)
}
testArgumentsConstructor();
</script>
</head>

<body>
</body>
</html>


```
 
结果：
![](http://dl.iteye.com/upload/attachment/0082/0315/a2cb748d-e562-3b1a-aa37-5777c316f2e6.jpg)