Phạm Thanh Nam
New member
What will be the output of the following JavaScript code?
A. false
B. true
C. error
D. undefined
Code:
<p id="demo"></p>
<script>
function myFunction()
{
var str = "100%!";
var patt1 = /\W/g;
var result = str.match(patt1);
var result = str.match(patt1);
if(result)
result=true;
else
result=false;
document.getElementById("demo").innerHTML = result;
}
</script>
B. true
C. error
D. undefined