I am trying to break from a foreach loop. I want to test conditions and break from the loop once the condition is met. The problem is it keeps looping through the json array, even on the false ones. I just want it to stop if the condition is met. I am aware that you cannot actually break from a foreach loop but what is a good alternative here? I am having trouble understanding where to put the break statements. Thank you very much.
 $.ajax({
        // Get the values of the cce json file
        url: 'file.json',
        success: function (data) {
            data.forEach(function(row) {                  
              if (row.ATTR == feature.properties.AATR) {
                 // code to execute here
                 // once the condition is met once, stop execution of foreach
               } else {
                // some other code to execute
               // keep going
               }
 
     
    