The match() of a String retrieves the result of matching the string against a regular expression.
const paragraph = 'The quick brown fox jumps over the lazy dog. It barked.';
const word = /fox/;
const paragraphMatchFox = paragraph.match(word);
console.log(paragraphMatchFox);
// ["fox"]