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 = "First come, first served";
var pattern = /first/gi;
document.write(st.match(pattern)[1]);
}
</script>

Choose the correct answer:
A) first
B) First come
C) First
D) served
Detailed Explanation

Option  A is the right Answer

Discussion (0)

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

Share Your Thoughts
Feedback