是否可以将函数的所有参数作为该函数内的单个对象获取? [英] Is it possible to get all arguments of a function as single object inside that function?

查看:28
本文介绍了是否可以将函数的所有参数作为该函数内的单个对象获取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 PHP 中有 func_num_argsfunc_get_args 是JavaScript 有类似的东西吗?

In PHP there is func_num_args and func_get_args, is there something similar for JavaScript?

推荐答案

使用 参数.您可以像访问数组一样访问它.使用 arguments.length 作为参数的数量.

Use arguments. You can access it like an array. Use arguments.length for the number of arguments.

这篇关于是否可以将函数的所有参数作为该函数内的单个对象获取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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