0

Hi what is the difference between the array in picture1 and array in picture2? Why can't I use array.length for the array in the 1st image? If I wanted to convert it to how it is in the second image how do I do that? *NOTE: this.allMasterModeldata[allcondtionstring[i].fieldName] is the array that is in the images

enter image description here

image2: enter image description here

for (var i = 0; i < allcondtionstring.length; i++) {
      for (var j = 0; j < allcondtionstring[i]?.fieldValue.length; j++) {
       
 /*716*/       console.log(this.allMasterModeldata[allcondtionstring[i].fieldName]);
        console.log((this.allMasterModeldata[allcondtionstring[i].fieldName]).length);

          if(168!=allcondtionstring[i].fieldValue[j]){
            console.log(this.allConditionFieldValue);
            this.allMasterModeldata[allcondtionstring[i].fieldName].push(this.allConditionFieldValue);
          }
          else{
            this.allMasterModeldata[allcondtionstring[i].fieldName];
          }                   
  /*704*/        console.log(this.allMasterModeldata[allcondtionstring[i].fieldName]);
      console.log(this.allMasterModeldata[allcondtionstring[i].fieldName].length);

        }  
      }

Any help will be appreciated

  • 1
    The first image illustrates that the array changed after it was logged. At the moment it was logged it was still empty, with length 0, but when you clicked on it in the dev console to see the details, you could see contents that were added to that array moments later. This is because the console does not copy all content to the output at the moment of logging. Don't rely on it. If you really want to see the content at the time of logging, convert it to JSON and output that. – trincot Sep 22 '22 at 22:16

0 Answers0