JSFiddle - React, Tailwind, and code Playground

by arpecop

JavaScript

function findMatchingWords(t, s) {
    var re = new RegExp("\\w*"+s+"\\w*", "g");
    return t.match(re);
}
function checkthis(message) {
    
 var myCars=["alone","troll","lol","press"];
    console.log(myCars.length);
    for (i=0;i<=myCars.length -1;i++)
{
findMatchingWords("a pressed expression produces some depression of pressure.", myCars[i]);
}
    
}
checkthis("a pressed expression produces some depression of pressure.");