Correct Answer: Nojava and javascript are two different languages Java is a powerful object - oriented programming language like C++,C whereas Javascript is a client-side scripting language with some limitations
Correct Answer: Generation of HTML pages on-the-fly without accessing the Web server The user can be given control over the browser like User input validation Simple computations can be performed on the client's machine The user's browser, OS, screen size, etc can be detected Date and Time Handling
Correct Answer: No JavaScript does not have block level scope, all the variables declared inside a function possess the same level of scope unlike c,c++,java
Correct Answer: jQuery is a quick as well as concise JavaScript Library that simplifies HTML document traversing, animating, event handling, & Ajax interactions for the purpose of quick web development needs So although they are not entirely different, both are not the same either!
8. How JavaScript timers work? What is a drawback of JavaScript timers?
Correct Answer: Timers allow you to execute code at a set time or repeatedly using an interval This is accomplished with the setTimeout, setInterval, and clearInterval functions The setTimeout(function, delay) function initiates a timer that calls a specific function after the delay; it returns an id value that can be used to access it later The setInterval(function, delay) function is similar to the setTimeout function except that it executes repeatedly on the delay and only stops when cancelled The clearInterval(id) function is used to stop a timer Timers can be tricky to use since they operate within a single thread, thus events queue up waiting to execute
9. What is Javascript namespacing? How and where is it used?
Correct Answer: Using global variables in Javascript is evil and a bad practice That being said, namespacing is used to bundle up all your functionality using a unique name In JavaScript, a namespace is really just an object that you?ve attached all further methods, properties and objects It promotes modularity and code reuse in the application
10. What are the different objects used in JavaScripts?
Correct Answer: JavaScripts uses a hierarchical structure that applies to the objects in a document There are some objects that show the relationship of one object to another using the language Window object: This is the topmost object in the hierarchy It represent the content area of browser window that consists of HTML documents Each frame is also a window that has some actions inside it Document object: This object gets loaded in a window and consists of objects of different kind in the model It consists of the content that will be written in the script Form object: Form objects are used for more interaction with the users It represents the form elements inside tag