<p>If it finds a match the test() method returns true, otherwise it returns false.</p>
<button onclick="yourFunction()">Try it</button>
<p id="demo"></p>
<script>
function yourFunction() {
var str = "What is your name?";
var patt = new RegExp("e");
var res = patt.test(str);
document.getElementById("demo").innerHTML = res;
}
</script>
2020-03-07