Showing posts with label Javascript Interview Questions and Answers. Show all posts
Showing posts with label Javascript Interview Questions and Answers. Show all posts

Sunday, October 25, 2015

Javascript Interview Questions and Answers

11) What is “SetTimeOut” function in javascript?
“SetTimeOut” function is used to call the function given as a parameter after some time delay. Below is the javascript code for the same –
setTimeout(function(){ alert("Text to Show"); }, 5000);
12) What is “SetInterval” function in javascript?
“SetInterval” function is used to call the function (given as a parameter) repeatedly after some time delay. Below is the javascript code for the same –
setInterval (function(){ alert("Text to Show"); }, 5000);
13) What is “ClearInterval” function in javascript?
“ClearInterval” function is used to clear the time set from function – “SetInterval()”.
14) How to give comments in javascript?
  • For single line comment – “//”
  • For multi-line comments – “/* */”
15) Why to use “===” operator in javascript?
“===” operator is called strict operator and it returns true when both the values are same and returns false when the values are not same.

Tuesday, October 20, 2015

Javascript Interview Questions and Answers

1) What is Javascript?
Javascript is a client side scripting language which is understood by the browsers and will be added in the HTML code.
2) Explain Javascript Types?
Below are some javascript types –
  • Boolean
  • String
  • Number
  • Null
  • Object
  • Function
  • Undefined
3) Why to use NaN in javascript?
“NaN” function is used check the number in the argument. If it does not contain number then it will return true else it will return false.
4) Explain negative infinity?
“Negative Number” is a number which is obtained from dividing the negative number by zero.
5) Can javascript code be broken into multiple lines?
Yes it is possible to break the javascript code to multiple lines using backslash ‘\’.
Eg: document.write(“My Test \a Content”);