Home > Article > Web Front-end > JavaScript uses output statements to implement web page special effects code_javascript skills
This article mainly talks about the three most commonly used output statements, including alert() pop-up warning box, printing input statement, and console output. Please see the specific method below, with pictures and very detailed comments.
The effect is as follows:
Because alert belongs to the method of window object, and window can be omitted
So, usually we write like this: alert(‘Welcome to learn’); // Pop up warning box
But, this, a dialog box will pop up every time, which will scare some timid people, hehe, just kidding, mainly because the user experience is not good. Therefore, use it as little as possible. It is generally used for testing
Document printout
There are two commonly used print input statements
Note: These two belong to document objects, and document cannot be omitted.
writeln is the abbreviation of write line and will generate a
Under normal circumstances, document.writeln() will generate a space at the end, and the difference between the two is usually not visible.
In the pre tag, there will be a line break. As follows:
The display effect is as follows:
Console output (console)
The effect is as follows:
The above is the entire content of this article, I hope you all like it.