I'm going to create a simple E-commerce application. I have API call, which returns variations object like below. I want to dynamically generate variation boxes. Right now I am receiving one option value, I want to receive options value like image which I have referred to. In addition, the select boxes are dynamic--there can be more than three variations. How can I achieve this result? Thanks in advance.
var variations = [{
NameValueList: [
{ Name: "Color", Value: ["Cloud White / Core Black"] },
{ Name: "US Shoe Size (Women's)", Value: ["11"] },
]
},
{
NameValueList: [
{ Name: "Color", Value: ["Cloud White / Core Green"] },
{ Name: "US Shoe Size (Women's)", Value: ["13"] },
]
},
{
NameValueList: [
{ Name: "Color", Value: ["Cloud White / Core White"] },
{ Name: "US Shoe Size (Women's)", Value: ["15"] },
]
},
]
document.getElementById("generateVariations").addEventListener("click", () => {
var html;
variations.map(el => {
html = el.NameValueList.map(nameValue => {
return `<select name="${nameValue.Name}">
<option value="${nameValue.Value[0]}">${nameValue.Value[0]}</option>
</select>`
})
})
document.getElementById("variations2").innerHTML = html.join('')
})
<div id="variations2"></div>
<button id="generateVariations">Generate variations</button>

NameValueListshould have aselecttag? and are theValuesproperty represent the the number ofoptions?select boxeswith 3optionson eachselect boxeswhich has all the same values right?