What is the output of following JavaScript code? <script type=\"text/javascript\
ID: 3541568 • Letter: W
Question
What is the output of following JavaScript code?
<script type="text/javascript">
function x()
{
var cst = "First come, first served";
var pattern = /first/gi;
document.write(cst.match(pattern)[1]);
}
</script>
a) first
b) undefined
c) First
d) Error
Which of these comment lines are used in JavaScript?
(1) // , /* ...... **/
(2) / , /** ......./ , /*
(3) /*......*/ , //
(4) *......* , //
a) Only (4)
b) Only (3)
c) Either (3) or (4)
d) Only (2)
3) What is the output of following JavaScript code?
<script type="text/javascript">
function x()
{
var s = "Give 100%!{[!!";
var pattern = /W/g;
var output = s.match(pattern);
document.write(output);
}
</script>
a) ,%,!,{,[,!,!
b) G,i,v,e,1,0,0
c) Give 100
d) Error
Explanation / Answer
1.a
2.b
3.a
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.