// declare a variable as a parameter var s = new param; // 定义时叫parameter // issue a function call using the parameter var o = output(dText.innerHTML, s, 'Hello, world.'); // the function is obviously designed to treat the 2nd argument as a parameter... function output(arg1, arg2, arg3) //在方法括号中接收参数的叫 argument { ... // ...so that eventually it can assign a value to it. arg2.setValue(a + b % 10); ... } // when ready to retrieve the output value, use the retrieval function. dResult.innerHTML += s.getValue() + ' (' + o + ')';
代码片段摘自:http://www.codeproject.com/Articles/11232/Passing-function-arguments-as-parameters-in-JavaSc
JavaScript参数传递详解
本文通过一个具体的JavaScript代码示例详细介绍了如何在JavaScript中定义和使用参数。包括如何声明变量作为参数、如何在函数调用中使用这些参数以及如何在函数内部处理这些参数。通过这个过程,读者可以了解到参数在函数调用中的作用。
824

被折叠的 条评论
为什么被折叠?



