Tuesday, November 19, 2013

Java script Interview questions - Part 2

1) What is unobtrusive java script?
A.Unobtrusive Java script means that the logic should be handle in the java script and HTML should only contain the view not the java script code.It is a clear division between the logic and UI.

2) What is Name spacing?
A. Java script is bad scripting language, it can lead to developer to escape with bad coding and achieve the functionality.One of the bad practice is to declare the global variables which is evil for the coding. Hence name spacing is the concept to declare a unique name and bundle all methods/objects/properties with that.It also helps us to avoid the name conflict too.

It helps in creating modularity and try to reuse the code in application?

3) What is Undefined and Null?
A. Undefined: When you have declare a variable but have not assigned and value to it.
                           Undefined is the "type" itself.
                           Undefined is always set by the java script with the value "undefined".

NULL: NULL is the assignment value.
            NULL is an object itself
             NULL is never set by the java script, it is done programmatic only.

4) Where we should place our java script on web page?
A. We should place our java script as an external file and at bottom of the page.





No comments:

Post a Comment