您可以使用正则表达式(\bregExp\b)来查找单词的完全匹配项。The \b metacharacter is used to find a match at the beginning or end of a word.let speech = "you ever looked at someone";let a = "look";if(new RegExp("\\b"+a+"\\b").test(speech)){ console.log("Whole Word Matches")} else { console.log("No Match!")}