var arr=['s','m','l','xl'];
var list=['白色','红色','蓝色','黑色'];
转化成多个SKU(如下):
[
{color:"白色",
size:"s"},
{color:"白色",
size:"m"},
{color:"白色",
size:"l"},
{color:"白色",
size:"xl"},
.......
]
for(var i=0,a=[];i<arr.length;i++){
for(var j=0;j<list.length;j++){
var b={};
b.size=arr[i];
b.color=list[j]
a.push(b)
}
}
console.log(a)