Created
October 27, 2016 08:49
-
-
Save lichenbuliren/34eae8847904d567619b21bd503e27be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sku() { | |
var result = []; | |
var arr = Array.prototype.slice.call(arguments); | |
(function fn(parameter, array, len) { | |
if (len == 0) return result.push(parameter); | |
for (var i = 0; i < array[len - 1].length; i++) { | |
fn(parameter.concat(array[len - 1][i]), array, len - 1); | |
} | |
})([], arr, arr.length); | |
return result; | |
} | |
sku(['16GB','32GB','64GB'],['金色','银色','黑色'],['移动','联通']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment