Write Your JavaScript Code Here

// match(): method is used to match the string against a regular expression. We can use global search modifier with match() method to get all the match elements otherwise the method return only first match. // string.match(regexp) let srt="Megatron" console.log(srt.match("Mega"));

Output: