I am encountering an issue where I am unable to access the element value inside the forEach() function
var filtered = rawData.map(function(x){
return {
state : x.state,
active : x.active,
deaths : x.deaths,
recovered : x.recovered
};
})
Trying to utilize the above in the following loop :
for(i=1; i<=filtered.length; i++){
let tr = document.createElement("tr");
tr.setAttribute("align","center");
document.querySelector('tbody').appendChild(tr);
ndata = ['state', 'active', 'deaths', 'recovered']
ndata.forEach((el, k) => {
let td$k = document.createElement('td');
td$k.innerText = filtered[i].$el; // <-- ERROR //
tr.appendChild(td$k);
});
An error message is displayed by the browser : app.js:201 Uncaught TypeError: Cannot read property '$el' of undefined