Answers for "alternative for .include in typescript"

0

alternative for .include in typescript

let shoppingList: string[] = [
  'Eggs',
  'Milk',
  'Fish',
  'Apple',
  'Bread',
  'Chicken',
];

function isThere(arr: string[]): void {
  let there1: boolean = arr.indexOf('Milk') > -1;
  let there2: boolean = arr.indexOf('Banana') > -1;

  console.log(there1);
  console.log(there2);
}

isThere(shoppingList);
Posted by: Guest on November-24-2020

Code answers related to "alternative for .include in typescript"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language