Skip to content

Instantly share code, notes, and snippets.

@iamakimmer
Created September 17, 2014 19:27
Show Gist options
  • Save iamakimmer/fc698109cd2977559a3d to your computer and use it in GitHub Desktop.
Save iamakimmer/fc698109cd2977559a3d to your computer and use it in GitHub Desktop.
letsdoRecursion
options = [{property: “name", variants: [A,B,C]}, {property: “size", variants: [1,2,3]} ,{property: “color", variants: [Blue,Green]}]
3x3x2 = 18 combinations
A-1-Blue
A-1-Green
A-2-Blue
A-2-Green
A-3-Blue
A-3-Green
B-1-Blue
B-1-Green
B-3-Blue
B-2-Green
B-3-Blue
B-3-Green
C-1-Blue
C-1-Green
C-2-Blue
C-2-Green
C-3-Blue
C-3-Green
function letsDoRecursion = function(options) {
//base case
if (options.length === 1) {
return options[0].variants;
} else {
blah
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment