How to display data in JavaScript.

How to display data in JavaScript.

JavaScript Outputs.

Hey there👋🏾, thanks for taking out time to read this, hope you’ve your snacks ready?

Time: 2mins read

JavaScript can display data in the following ways,

  • Innerhtml

    you ever thought about changing the html content in a different way? yeah, Exactly! You can do this with JavaScript, this happens when you give the html element a unique identifier like ‘ id or class ’ selector. The ‘ innerhtml ‘ gives content to the html.

Here’s the code to get started:

‘ Document .getelementid().Innerhtml=() ‘

Unto the next,

  • Document.write()

Not sure of the code? Want to test it out? This display feature is used for testing out your code.

It shouldn’t be called on by an event, so as not to disrupt the html code.

Here’s the code:

‘ Document.write() ‘

  • Window.alert

Seen those beautiful alerts that comes as a feedback on the browser? Yeah this is what the ‘ .alert ‘ method is used for, it displays data in form of alerts

Here’s the code:

‘ window.alert ‘

The ‘ .window ‘ object is a general scope object in JavaScript.

  • Console .log()

Having issues with that code? Got a bug to fix? The ‘ console .log() ‘ is used for debugging in the console. Here’s the code:

‘ Console .log() ‘

  • window .Print

Got thrilled when i used this for the first time. I was like a code could actually call a method on a browser?

The ‘ window .print ‘ basically calls the method on the browser that prints out the current page. Here’s the code:

‘ Window .print ‘

Quite done now, thank you for taking a read, have fun doing all of this :).

Can’t wait to see you next time!