JSFiddle - React, Tailwind, and code Playground

by rsm23

JavaScript

String.prototype.containsAny = String.prototype.containsAny || function(arr) {
  for (var i = 0; i < arr.length; i++) {
    if (this.indexOf(arr[i].normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLowerCase()) > -1) {
      return true;
    }
  }
  return false;
};

var str = "lecture de mots courants et vocabulaire. l'enfant doit lire les mots et, en fonction de la categorie,  choisir la couleur correspondante. grandes images - image puzzle";

var arr = ["ferm", "puzz"]

console.log(str.containsAny(arr))