function isVow(a) {
console.log(a);
}
isVow([1232, 1, 342], [3, 2, 4]);
// console output [1232, 1, 342]
如何向控制台显示[3, 2, 4]
?
答案 0 :(得分:2)
您需要第二个参数b
function isVow(a,b) {
console.log(b);
}
isVow([1232, 1, 342], [3, 2, 4]);
修改强>
您可以使用1个参数尝试此操作:
function isVow(a) {
console.log(a[1]);
}
isVow([[1232, 1, 342], [3, 2, 4]]);
答案 1 :(得分:1)
您需要添加到第二个参数b
function func(a,b){
console.log(a,b);
}
isVow([1232, 1, 342], [3, 2,4]);
答案 2 :(得分:0)
您可以这样做:
function func(){
if(arguments.length > 1) {
console.log(arguments[1]);
}
}
详细了解arguments object
答案 3 :(得分:0)
你需要使用下面的函数参数
function isVow() {
console.log('arguments[0]' , arguments[0]);
console.log('arguments[1]' , arguments[1]);
}
isVow([1232, 1, 342], [3, 2, 4]);
你得到这样的输出
arguments[0] [1232, 1, 342]
arguments[1] [3, 2, 4]
...欢呼声