this is my function and I want to break the loo when the condition is met, but I'm getting an error:
SyntaxError: Illegal break statement
Im using protractor with javascript.
async CompareTableData(byElement, param) {
  try {
    await this.WaitToBeClickable(element(By.cssContainingText(byElement.value, param)));
    await element.all(byElement).then(async function(item) {
      for (var i = 0; i < item.length; i++) {
        item[i].getText().then(async function(text) {
          var trimTxt = text.trim();
          if (await trimTxt == param && byElement.using == "css selector") {
            console.log(`Param FOUND! ${param}\n`);
            await expect(element(By.cssContainingText(byElement.value, param)).isPresent()).toBe(true);
            break;
          } else {
            return;
          }
        });
      }
    });
  } catch (err) {
    console.log("Table comparison FAILED, element not present!");
    return console.log(err);
  }
};
 
     
    