Uncaught TypeError: Cannot read property 'length' of null

I am not able to solve this length error in for loop, here is my code below

function fetchIssues() {
  var issues = JSON.parse(localStorage.getItem('issues'));
  var issueListe = document.getElementById('issuesList');

  issuesList.innerHTML = '';

  for (var i = 0; i < **issues.length**; i++){
    var id = issues[i].id;
    var desc = issues[i].description;
    var severity = issues[i].severity;
    var assignedTo = issues[i].assignedTo;
    var status = issues[i].status;
}

Calling method on body - <body onload="fetchIssues()"> in HTML

That means that this line is failing (or at least not returning what you’re expecting…)

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.