JavaScript write method

Notes:

JavaScript document.write method :

document.write(argument);

W.K.T. in JavaScript a name followed by pair of parenthesis is identified as a method or function.
Hence write is a method or function, because it is followed by pair of parenthesis or brackets.

The write method is present within the JavaScript document object; hence we say write method is a member method of document object.

To access write method we use dot operator (i.e. also known as member access operator).

JavaScript write method is used to write or display some content in the browser window.

The content passed to the write method is also known as parameter or argument.
To the write method we can pass a single value or an expression i.e. single argument
To the write method we can pass multiple values separated by commas i.e. multiple arguments

Ex:
document.write(2);
document.write(“Hello World”);
document.write(2+2);
document.write(“2”+”2”);
document.write(2,2);
document.write(“2”,”2”);

Note:
() parentheses are evaluated inner most to outer most
+ operators are evaluated from left to right
, separators are evaluated from left to right

Interview Questions: