Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote