Search This Blog

Monday, July 18, 2022

how-to-add-a-property-to-each-object-in-an-array-of-objects-with-javascript

    

   this.pricingDetailData=res["pricedata"]; this.pricingDetailData.forEach((element:any) =>
    {
      let item = {

     
 
     
          "ASO":  [ "497", "26" ,"33", "497", "26" ,"33", "497", "26" ,"33", "50"],
          "TSM" : [ "497", "26" ,"33", "497", "26" ,"33", "497", "26" ,"33", "50"]
     
      }
   
       element.asoTsmData  = item;
    });                          https://thewebdev.info/2021/05/11/ how-to-add-a-property-to-each-object-in-an-array-of-objects-with-javascript/#:~:text=We%20can%20use%20the%20forEach,add%20a%20property%20to%20each.&text=We%20have%20the%20arr%20array,b%20property%20to%20a%20value.&text=according%20to%20the%20console%20log.                                                            

No comments:

Post a Comment

Validating to select in sequencial order using angular

    < input type = "checkbox" (change) = "handleSelectTaskItem($event, taskItem)" [checked] = " taskItem . i...