Create a regular expression literal and test a word.

Regex Literals

regex_literal.js
const word = "cat";
const pattern = /cat/;
const matched = pattern.test(word);

console.log("word=" + word);
console.log("matched=" + matched);
regex-literal A regular expression literal writes a pattern between slashes. The `test` method returns a boolean for whether the pattern appears in the text.