Answers for "check if character is available in string"

0

check if character is available in string

function mutation(arr) {
 let first = arr[0].toLowerCase();
 let second = arr[1].toLowerCase();

  for(let i = 0; i < second.length; i++) {
    if(first.indexOf(second[i]) < 0) return false;
  }

  return true;
}

mutation(["hello", "hey"]);
Posted by: Guest on September-04-2021

Code answers related to "check if character is available in string"

Browse Popular Code Answers by Language