When i first begun programming, i used JavaScript not on the web, but in processingjs.

When i started to look at javascript in the web field (it was not as elegant as used in conjunction with processingjs) , i was wondering where the “print” statement was . . .

In processingjs i had text( ), in C++ i had cout, humm javascript was weird for sure in it’s original environment.

Over the course of time, i found out the six output ways (excluding text files of course, more html5 than js) of JavaScript.

Believe me, they add up to 6, yes 6. In all probability, you might be hearing that for the first time !

1) document.write( );

This when used on a page, overrides the whole content

2) console.log( );

Used mainly for debugging, prints in your browser’s console.

3) .innerHTML

Can be used to change the content of a specific tag or class . . .

4) alert( );

Shows a popup label

5) confirm( );

Shows a label and two choices and actions decided on the choice

6) prompt( );

Shows labels.

Asks user for input

It really amazed me , JavaScript has 6 channels for output . . . Incredible . . . Fabulous . . . Incredibly fabulous . . .



Advertisements