How to check if a list contains the element passed in javascript

I want to check if the list returned from the application contains the expected element.Please let me know where am going wrong :

this.verifyOptionsInDrpDwn = async function(){
      var optionList = await drpDwn.all(by.tagName('option')).getText();
      var expOptions=['a','b','c','d','e','f'];
      for (let i = 0; i < expOptions.length; i++) {
           var bool=optionList.includes(expOptions[i]);
 output :



includes determines whether an array includes a certain value among its entries. But in your case, you want to check if the elements of that array contain the value of the expOptions.

If you replace var bool=optionList.includes(expOptions[i]); with var bool= optionList.some((a) => a.includes(expOptions[i]));, it should work.