JavascriptQuiz 1 Solutions(part 1)

in javascriptquiz •  4 years ago 

Ans1.

Output will be 2 alert messages one after another first inner one i.e "hello" then outer will pop with "undefined "

Ans2.

A blank alert pop up

Ans3.

An Undefined alert pop up with console logged with "@double-u has more than 2700000 BP "

Ans4.

will print on console as it is "window.alert( x++ )" because it is a string.
##Ans5.
Syntax error as quotes (" ") are missing
##Ans6.

                 <script>
                  var x = 20 ;
                   for(i=0; i<x ; i++)
                   { 
                     console.log("x is now " + x ); 
                   }

It will print "x is now 20" 20 times on console

Ans7.

a) it will print "x is now 20" "x is now 19" and so on till 11 as " i" value will become more then x.
b) it will print "x is now 20" after that i" value will become more then x.
d)it will print "x is now 20" 20 times

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!
Sort Order:  

Thanks for your participation:

so here are the correction in your answers.

In ans 7 :

part c answer is :
2 times x is now 20
x is now 19
x is now 17
x is now 14
x is now 10

In part d we will be stuck in a infinite console message with different messages so maybe you should try running the code i the browser and tell me what happened.

Keep practising and thanks again for your participation.