What will be the output of the following JavaScript code? [code] <p id="demo"></p> <script> function myFunction() { var str = "Visit

Linh Chi

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

Tìm kiếm

Back
Top