For this simply create one html file and and for access the data for html file you may create one id like, <p id=”demo”></p> and then inside the script tag call the id attribute. syntax is like – document.getElementById(“demo”).innerHTML=2+2; .
In this method no need to create any attribute for fetch or access the data, because in this method no need to create an id or content for accessing to the data. in this automatic browser can access the which write in the document.write() box inside the script tag . for syntax like this – document.write(2+2); .
In this method, if you can use an alert box to display data. also, you can skip this window word. It not necessary to write a word. In this window, word specifies as a keyword. This window object is a global scope object, which means by default variable, keywords, properties belong to the window object. For this syntax is like – alert(2+2); so output given in the alert box.
In this method, you can call the windoe.log() method in the browser to display the data. for this it’s simply written console.log(2+2);
window.print() method in the browser to print the content of the current window. The example is given below –
<html> <body> <h2>The window.print() Method</h2> <p>Click the button to print.</p> <button onclick="window.print()">Print the page</button> </body> </html>
output is like –
Also visit this articles :-
- What is Boolean in Python?
- Get Watch Dogs 2 For Free Right Now!
- How to send data from one activity to the second activity.
- How to Install Chrome OS On PC.
If you have any doubts any suggestions or any query DM us one below Social media handles.
Our Social Media Handles:-
Instagram Handle :- https://www.instagram.com/smgplaza/
Twitter Handle :- https://twitter.com/smgplaza
Thank you so much. You have to follow us using your mail id and also follow us on social media for more updates.