If you’re trying to match the string(wrap the text inside single/double quote). Use the below code.
function check(el) {
if (el === 'this') {
alert("contain!");
return el;
} else {
alert("not contain this keyword");
}
}
check('this');
1
solved Javascript check if parameter contain this keyword [closed]