JavaScript Basic: Prompt & C

作者: 此之木 | 来源:发表于2019-05-30 06:47 被阅读14次

Today the course assigned a simple JavaScript exercise:

Here is my steps:

Step One: Create a HTML page and link to the JavaScript File

I create a simple HTML page and give a title “JS Stalker Exercise”. Then, I link the HTML page to a new JS file named “stalker.js”.

Step Two: Enter variable data in the JS file

In the JS file, I start to write three prompt messages which are asking for user’s first name, last name and age.

In order to print out user’s full name and age in separate sentences, I set two console.log message. The only thing we need to pay attention is the spacing between each word. 

The print sentence has one small space between each word : Your full name is X X. Therefore, in the console.log, we need to set the right space for each word.

Step Three: Test the result

When I open the page, it asks me three pop up questions in orders:

After I answer each questions, I can see the print sentences in the console.

相关文章

网友评论

    本文标题:JavaScript Basic: Prompt & C

    本文链接:https://www.haomeiwen.com/subject/vbvqoqtx.html