Java Script Interview Question and Answer

49. Explain how to read and write a file using JavaScript?
There are two ways to read and write a file using JavaScript
Using JavaScript extensions
Using a web page and Active X objects

50. Explain how to detect the operating system on the client machine?
In order to detect the operating system on the client machine, the navigator.appVersion string (property) should be used.

51. What is the difference between JavaScript and Jscript?
Both are almost similar. JavaScript is developed by Netscape and Jscript was developed by Microsoft .

52. How can a value be appended to an array?
A value can be appended to an array in the given manner
arr[arr.length] = value;

53. How are event handlers utilized in JavaScript?
Events are the actions that result from activities, such as clicking a link or filling a form, by the user. An event handler is required to manage proper execution of all these events. Event handlers are an extra attribute of the object. This attribute includes event’s name and the action taken if the event takes place.

54. How are JavaScript and ECMA Script related?
ECMA Script are like rules and guideline while Javascript is a scripting language used for web development.

55. How typeof operator works?
The typeof is a unary operator that is placed before its single operand, which can be of any type. Its value is a string indicating the data type of the operand.
The typeof operator evaluates to “number”, “string”, or “boolean” if its operand is a number, string, or boolean value and returns true or false based on the evaluation.

56. Which built-in method reverses the order of the elements of an array?
reverse() method reverses the order of the elements of an array −− the first becomes the last, and the last becomes the first.

COPY CODE SNIPPET