Simple solution for complex problem

Hello guys, till now I have a basic knowledge of JavaScript. If didn’t read or learn this article so click on this link,

Now In this article, you can see the method/Display possibilities, statement, and syntax. Also, for this you may learn basic HTML so that prefer this to understand the hole HTML language, so link –  https://techiebot55.blogspot.

JavaScript display possibilities.

In this 4 related method here is like, innerHTML, document.write(), window.alert(), console.log(). For access the data. JavaScript can use the document.getElementById(id) method. In id attribute define a html element and also fecth the data to the Html page. The innerHTML() define as a html content.

innerHTml method.

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;

document.write method.

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); .

window.alert() method.

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.

console.log() method.

In this method, you can call the window.log() method in the browser to display the data. For this it’s simply written  console.log(2+2);

JavaScript Print() function.

JavaScript doesn’t have any print object or print methods. The only exception is that you can call the window.print() method in the browser to print the content of the current window. The example is given below –


<h2>The window.print() Method</h2>
<p>Click the button to print.</p>

<button onclick="window.print()">Print the page</button>


output is like :-

Also, visit these articles:-

If you have any doubts any suggestions or any query DM us one below Social media handles.

Our Social Media Handles:-

Instagram Handle :-

Twitter Handle :-

Thank you so much. You have to follow us using your mail id and also follow us on social media for more updates.

Riya Shah

Hey, I am Riya Shah. I am a Python developer. I am pursuing BTech. currently, I am in 2nd year. I am a blogger from India. I started blogging in Smgplaza to share my knowledge and more.


Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: