mercredi 7 novembre 2018

IF Statement and Array of Objects JavaScript

Hi I have made an webpage which help determines quality of output judged by the if statement within it which checks against the array but I cannot get it to work. Below is a link to the code. before I was having repittition with the array but now I am having this issue.

  function TableChildClear()
        {
        var new_tbody = document.getElement('tbody');
        populate_with_new_rows(new_tbody);
        old_tbody.parentNode.replaceChild(new_tbody, old_tbody)
        }

          function QueueTableCreation()
      {
         PageDisplay.forEach(function(element, index){

          var row = QueueTable.insertRow(1);
          var PageType = row.insertCell(0);
          var Quality = row.insertCell(1);
          var Time = row.insertCell(2);
          PageType.innerHTML = element[0];
          Quality.innerHTML = element[1];
          Time.innerHTML = element[2];


         //console.log([...new PageDisplay([1,2,3,1,2])])
         const dedupedArr = [...new PageDisplay(arr)]
        })
      }

      function PageDisplayArray()
      {

            PageDisplay.forEach(function(element) {
            SecondsTotal += element[2];       });

            if (SecondsTotal  >= 8) {
              Time = 0.2;
              Quality = "Low";
            } else if (SecondsTotal >= 5 && SecondsTotal <8 ) {
              Time = 0.5;
              Quality = "Medium";
            } else {
              Time = 1;;
              Quality = "High";
            }
            var Category = document.catTable.Categories.value;
            PageDisplay.push([Category, Quality, Time]);



          QueueTableCreation()
          TableChildClear()
          console.log(PageDisplay)
      }




      function ProcessPageDisplayArray()
      {
          PageDisplay.shift();

           var DisplayList = document.createElement("li");
          console

      }


https://pastebin.com/Nsqj1pYx

Thanks

Aucun commentaire:

Enregistrer un commentaire