Home » » JavaScript Objective Questions and Answers Module -3

JavaScript Objective Questions and Answers Module -3

21.Can javascript code be broken in different lines? 
Breaking is possible within a string statement by using a backslash \ at the end but not within any other javascript statement.
that is ,
document.write("Hello \ world");
is possible but not document.write \
("hello world");

22.What looping structures are there in JavaScript?
for, while, do-while loops, but no foreach.

23.How do you create a new object in JavaScript?
var obj = new Object(); or var obj = {};

24.What is this keyword?
It refers to the current object.


25.What is the difference between SessionState and ViewState? 
ViewState is specific to a page in a session. Session state refers to user specific data that can be accessed across all pages in the web application.


26.What looping structures are there in JavaScript? 
for, while, do-while loops, but no foreach.

27.To put a "close window" link on a page ? 
<a href='javascript:window.close()' class='mainnav'> Close </a>

28.How to hide javascript code from old browsers that dont run it? 
Use the below specified style of comments <script language=javascript> <!-- javascript code goes here // --> or Use the <NOSCRIPT>some html code </NOSCRIPT> tags and code the display html statements between these and this will appear on the page if the browser does not support javascript

29.How to comment javascript code? 
Use // for line comments and
/*
*/ for block comments

30.Name the numeric constants representing max,min values 
Number.MAX_VALUE

Number.MIN_VALUE

0 comments:

Post a Comment