Check the jquery code bellow. I want to itarate though list of text from array successMessage
and find if there any match in pageHtml
variable. If u check there already a matching world message
but console.log(match)
always returning null. Whats wrong i am doing here? JsFiddle
const successMessage = [
"お名前",
"another success message"
];
jQuery.each(successMessage, function(index, success_msg) {
//console.log(success_msg);
var pageHtml = "message";
var match = pageHtml.match('/'+success_msg+'/gi');
console.log(match);
});