Solved! Go to Solution.
When using a variable as a field name, you have to use bracket notation to get the attribute of that field. You can also use template literals to construct your strings. And when looping through an array, the variable is just the index. You have to get the value of the array at that index.
html = '<html table header stuff>';
var daynames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
for (var d in daynames) {
html += `<tr>${daynames[d]}: ${$feature[daynames[d]]}</tr>`;
}
When using a variable as a field name, you have to use bracket notation to get the attribute of that field. You can also use template literals to construct your strings. And when looping through an array, the variable is just the index. You have to get the value of the array at that index.
html = '<html table header stuff>';
var daynames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
for (var d in daynames) {
html += `<tr>${daynames[d]}: ${$feature[daynames[d]]}</tr>`;
}