Last Updated : Jan 1, 2023
In any language, it is mandatory also for the beginner that he must knew how to print output, text or any other which he want. So, in this article let us understand how to done this.
As, there are many ways with help of which we are able to display variable value.
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Here, then we create a body tag. All the content which we want to show on browser’s screen or display is always written inside this codes.
- Here inside script, the first way is to use html tags to print output. Here, we use our paragraph tag with help of id and change its inner html using inner html and assigns value 10 + 10to this. It will add them and show 20 as output.
- Now, in next case we did not use any html tag to print or say show output. We just use document.write() function, which is inbuilt function to print or display output. Inside this function we directly give value to display output.
- One thing to say here that we can store these values in a variable and print that variable also. It’s an assignment for you and you must have to try it own.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.