In this article, you will learn what is JavaScript test() Method
<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>
JavaScript test() Method
minify code