Interview Preparation System Design Interview Objective
May 10, 2013

What is the output of following JavaScript code?
<script type="text/javascript">
function x()
{
var st = "We are fast growing Software Company located in Chennai, India.";
var pattern = new RegExp("in","gi");
document.write(pattern.exec(st) + " ");
document.write(pattern.exec(st) + " ");
document.write(pattern.exec(st) + " ");
}
</script>

Choose the correct answer:
A) n null null
B) in in in
C) in in n
D) in in In
Detailed Explanation

Option  D is the right Answer

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback