Category Archives: Javascript Questions

Javascript Interview Questions and Answers – Part16

151. A test to see if Javascript has block scope So, back to the original question: does Javascript have block scope? Instead of just giving you a simple yes/no answer, let’s run a test to see if it does since that will really help you remember the answer: function scopeTest() { /* consider this simple

Javascript Interview Questions and Answers – Part15

141. What happens when you don’t declare a variable in Javascript? As we showed in the code above, by not declaring the variable testVar in the code above we were accessing a global variable. If we did not already have that global variable declared earlier, then we would be creating what’s called an implied global

Javascript Interview Questions and Answers – Part14

131. What will be the output of the following statements? var myString = ‘Vikas’ // Create a primitive string object. var myStringCopy = myString; // Copy its value into a new variable. var myString = null; // Manipulate the value console.log(myString, myStringCopy); Ans: // Logs ‘null Vikas’ 132. Consider the following statements and tell what

Javascript Interview Questions and Answers – Part13

121. Why it is not advised to use innerHTML in JavaScript? innerHTML content is refreshed every time and thus is slower. There is no scope for validation in innerHTML and, therefore, it is easier to insert rouge code in the document and, thus, make the web page unstable. 122. What does the following statement declares?

Javascript Interview Questions and Answers – Part12

111. What is the method for reading and writing a file in JavaScript? This can be done by Using JavaScript extensions (runs from JavaScript Editor), example for opening of a file – fh = fopen(getScriptPath(), 0); 112. How are DOM utilized in JavaScript? DOM stands for Document Object Model and is responsible for how various

Javascript Interview Questions and Answers – Part11

101. What is inside the global object? When the global object is created, it is given some initial properties. These properties include: global functions such as parseFloat(), and eval() global properties such as NaN and Inifinity global objects such as Intl and Math 102. What is top-level Javascript code? Top-level Javascript code is Javascript code

Javascript Interview Questions and Answers – Part10

91. Describe the properties of an anonymous function in JavaScript? A function that is declared without any named identifier is known as an anonymous function. In general, an anonymous function is inaccessible after its declaration. Anonymous function declaration – var anon = function() { alert('I am anonymous'); }; anon(); 92. What is the difference between

Javascript Interview Questions and Answers – Part9

81. Explain the for-in loop? The for-in loop is used to loop through the properties of an object. The syntax for the for-in loop is – for (variable name in object){ statement or block to execute } In each repetition, one property from the object is associated to the variable name, and the loop is

Javascript Interview Questions and Answers – Part8

71. What is event bubbling and capturing in JavaScript? Event bubbling is series of events when : An event is triggered on the inner most element first and then it triggers on the parent elements in nested order. DOM elements could be nested inside each other. The handler of the parent works even if you

Javascript Interview Questions and Answers – Part7

61.  What is the difference between “==” and “===”? “==” checks equality only, “===” checks for equality as well as the type. 62.  How can the OS of the client machine be detected? The navigator.appVersion string can be used to detect the operating system on the client machine. 63. How to access the value of a

Subscribe Now!
Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.

Subscribe Here

Popup Dialog Box Powered By :
  • RSS
  • Facebook
  • Google+
  • Twitter