javascript中的参数和参数有什么区别? [英] What is the difference between arguments and parameters in javascript?

查看:138
本文介绍了javascript中的参数和参数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道参数是传递给函数的变量,并为函数中的参数赋值,但我无法理解:

I know that a parameter is a variable passed to a function and gives value to the argument in the function, but I'm having trouble understanding:

什么是javascript中arguments和parameters之间的主要区别是什么?

What is the main difference between "arguments" and "parameters" in javascript?

推荐答案

参数是别名对于将传递给函数的值。参数是实际值。

The parameters are the aliases for the values that will be passed to the function. The arguments are the actual values.

var foo = function( a, b, c ) {}; // a, b, and c are the parameters

foo( 1, 2, 3 ); // 1, 2, and 3 are the arguments

这篇关于javascript中的参数和参数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆