Java Script Interview Question and Answer

17. What are escape characters?
Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.

18. What is the use of blur function?
Blur function is used to remove the focus from the specified object.

19. What are JavaScript Data Types?

20. What are undeclared and undefined variables?
Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered.
Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.

21. Explain how can you submit a form using JavaScript?
To submit a form using JavaScript use document.form[0].submit();

22. What is break and continue statements?
Break statement exits from the current loop.
Continue statement continues with next statement of the loop.

23. What boolean operators can be used in JavaScript?

The ‘And’ Operator (&&), ‘Or’ Operator (||) and the ‘Not’ Operator (!) can be used in JavaScript.

24. What are Screen objects?
Screen objects are used to read the information from the client’s screen. The properties of screen objects are –
AvailHeight: Gives the height of client’s screen
AvailWidth: Gives the width of client’s screen.
ColorDepth: Gives the bit depth of images on the client’s screen
Height: Gives the total height of the client’s screen, including the taskbar
Width: Gives the total width of the client’s screen, including the taskbar