string match javascript boolean code example
Example 1: javascript boolean regex match
//RegExp.prototype.test()
str = 'ok';
regex = /ok/;
console.log(regex.test(str)) // => true
Example 2: javascript inbuilt funcctions to match the word and return boolean
String.prototype.isMatch = function(s){
return this.match(s)!==null
}