function heBing() {
let result = [];
let length = arguments.length;
if(length < 2) {
alert('参数输入有误');
}
else {
for(let i = 0; i < length; i++) {
if(Array.isArray(arguments[i])){
for(let j = 0; j < arguments[i].length; j++) {
result.push(arguments[i][j]);
}
}
else {
result.push(arguments[i]);
}
}
return result;
}
// return result; // 如果return写在这里,在length<2的情况下弹出警告框之后程序仍会运行,会在console控制台输出result的当前值[]
}
// 测试
/* console.log(heBing([1,3,5],'nihao',['h', 3]));
console.log(heBing(3)); */