Java Script Interview Question and Answer

57. Which type of variable among global and local, takes precedence over other if names are same?
A local variable takes precedence over a global variable with the same name.

58. What are the advantages of using JavaScript?
Following are the advantages of using JavaScript −
Less server interaction − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.
Immediate feedback to the visitors − They don’t have to wait for a page reload to see if they have forgotten to enter something.
Increased interactivity − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.
Richer interfaces − You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.

59. Which company developed JavaScript?
Netscape is the software company who developed JavaScript.

60. What are all the looping structures in JavaScript?
Following are looping structures in Javascript:
For
While
do-while loops

61. What do mean by NULL in Javascript?
The NULL value is used to represent no value or no object. It implies no object or null string, no valid boolean value, no number and no array object.

62. What are all the types of Pop up boxes available in JavaScript?
Alert
Confirm
Prompt

63. What is the difference between .call() and .apply()?
The function .call() and .apply() are very similar in their usage except a little difference. .call() is used when the number of the function’s arguments are known to the programmer, as they have to be mentioned as arguments in the call statement. On the other hand, .apply() is used when the number is not known. The function .apply() expects the argument to be an array.

64. What are disadvantages of using JavaScript?
We can not treat JavaScript as a full fledged programming language. It lacks the following important features −
Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason.
JavaScript can not be used for Networking applications because there is no such support available.
JavaScript doesn’t have any multithreading or multiprocess capabilities.

COPY CODE SNIPPET