DEV Community

Cover image for JAVASCRIPT DISPLAY POSSIBILITIES.
Somtochukwu Nnaji
Somtochukwu Nnaji

Posted on

JAVASCRIPT DISPLAY POSSIBILITIES.

**

WHAT IS JAVASCRIPT DISPLAY POSSIBILITIES ?

**
JavaScript display output or display possibilities is the feasible ways of displaying the output of a given code. Just like in CSS the “display” property when the value is set to “flex” it changes the default display of the container be it inline or block element property.

JavaScript Display Possibilities
The output can be display by using four different ways which are listed below:

  1. innerHTML:
    This method sets or returns the HTML content of an element. You can also say that it is used to access an element.

    <p id="cool">hey</p>
    <script>
    document.getElementById('cool').innerHTML = "Hello world!";
    </script>.

  2. document.write():

    This method is mostly used for testing purpose. it is used to write some content or JavaScript code in a Document. also used to delete all the content from the HTML document and inserts the new content.
    <script>
    document.write('How are you?');
    </script>

  3. window.alert():
    You can use alert box to display data. The alert box is mostly used when you want an information to come through to the user. It is displayed with a message and an OK button.
    <script>
    window.alert("Hello world!")
    alert(" HEY!" )
    </script>

    NOTE: These are both the same syntax.

  4. console.log():
    The console.log() method outputs a message to the web console. The message may be a single string or it may be any one or more JavaScript objects.
    <script>
    console.log(6+3)
    </script>

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay