|
|
document.writeWe can use document object to send output to the client browser from our JavaScript code block. This is a simple way to send output and we can print any text we want to write. We can print the output within our JavaScript code block only.
document.write(“Hello World”);
The above command will print Hello World in the web browser. We can print variables like this.
my_var=”Hello World”
document.write(my_var)
We can print two variables like this
my_var="Hello World"
my_var1="Hello World"
document.write(my_var + my_var1)
To add a line break between two variables we can write like this.
We can add line break before this by using document.writeln but it does not work properly so it is better to add a line break like above example where ever required.
document.write(my_var + "<br>"+my_var1 )
We can add line break before this by using document.writeln but it does not work properly so it is better to add a line break like above example where ever required.
|
| |
|
|
|
|
|