Web Development Interview Questions

What is the difference between Java and JavaScript?

Post Views: 36,891 Don’t be fooled by the term Java in both. Both are quite different technologies. The key differences can be summarized as follows: JavaScript variables are dynamically typed, whereas the Java variables are statically typed. var myVar1 = “Hello”;         //string type var myVar2 = 5;               //number type var myVar3 = new Object( );   //empty object type var myVar4 = {};              //empty object type — JSON (JavaScript Object Notation) style. In JavaScript properties and methods are dynamically added, whereas…

Read More

What is unobtrusive javascript? How to add behavior to an element using javascript?

Post Views: 36,838 Unobtrusive Javascript refers to the argument that the purpose of markup is to describe a document’s structure, not its programmatic behavior and that combining the two negatively impacts a site’s maintainability. Inline event handlers are harder to use and maintain, when one needs to set several events on a single element or when one is using event delegation. <input type=”text” name=”date” /> Say an input field with the name “date” had to be validated at runtime: document.getElementsByName(“date”)[0].…

Read More

What are Javascript closures?When would you use them?

Post Views: 36,838 Two one sentence summaries: a closure is the local variables for a function – kept alive after the function has returned or a closure is a stack-frame which is not deallocated when the function returns. A closure takes place when a function creates an environment that binds local variables to it in such a way that they are kept alive after the function has returned. A closure is a special kind of object that combines two things:…

Read More