// match: it takes a substring or regular expression pattern as an argument and it returns an array if there is match if not it returns null. Let us see how a regular expression pattern looks like. It starts with / sign and ends with / sign.
letstring='love'
letpatternOne=/love/// with out any flag
letpatternTwo=/love/gi// g-means to search in the whole text, i - case insensitive
string.match(substring)
letstring='I love JavaScript. If you do not love JavaScript what else can you love.'
console.log(string.match('love'))//
/*
output
["love",index:2,input:"I love JavaScript. If you do not love JavaScript what else can you love.",groups:undefined]