function Zuhe() {
var heads = arguments[0];
for (var i = 1, len = arguments.length; i < len; i++) {
if (arguments[i].length) {
heads = addNewType(heads, arguments[i]);
}
}
return heads;
}
function addNewType(heads, choices) {
var result = [];
for (var i = 0, len = heads.length; i < len; i++) {
for (var j = 0, lenj = choices.length; j < lenj; j++) {
result.push(heads[i] + '/' + choices[j]);
}
}
return result;
}
调用:
Zuhe(["S1","M2","L3"],["R9","B10"],["a1","b2","c3"]);
Zuhe(["a1","a2","a3"],["b1"],[],[]);