The problem of asking for help to jump out of the cycle

this.tableData.map((item,index) =>{
                  if ( item.discount !== 1 ) {
                    for (let index = 0; index < discountData.length; indexPP) {
                      if (item.discountId === discountData[index].id){
                        flag = true;
                      } 
                    }
                    if (!flag) {
                      item.discount = 2;
                      console.log("dsfdsf");
                    }
                  }
                });

to check whether there is any data stored in tabledata in discountdata, it is now written according to id matching, once the first few matches

if (item.discountId === discountData[index].id){
                        flag = true;
                      } 

after that, it will not continue. How should I change it

?
Mar.03,2021

Loop with forEach, and then use break, to jump out of the loop

this.tableData.forEach((item,index) =>{
      if ( item.discount !== 1 ) {
        for (let index = 0; index < discountData.length; indexPP) {
          if (item.discountId === discountData[index].id){
            flag = true;
            break;
          } 
        }
        if (!flag) {
          item.discount = 2;
          console.log("dsfdsf");
        }
    }
});

do not use map. Use foreach. Map cannot be jumped out

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3edc2-2bc94.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3edc2-2bc94.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?