I want to populate a dropdown menu using this array. I only want the 'planets' to be on the dropdown, not the numbers. I think it might roughly look like this :
for (var i = 0; i < arr.length; i++) {
var option = document.createElement("OPTION"),
txt = document.createTextNode(arr[i]);
option.appendChild(txt);
option.setAttribute("value", arr[i]);
select.insertBefore(option, select.lastChild);
}
But I am not sure how to access the planets only...
var planets = [
['Pluto', 0.06],
['Neptune', 1.148],
['Uranus', 0.917],
['Saturn', 1.139],
['Jupiter', 2.640],
['Mars', 0.3895],
['Moon', 0.1655],
['Earth', 1],
['Venus', 0.9032],
['Mercury', 0.377],
['Sun', 27.9]
];
Thank you.