The following answers are correct: www.w3school.com.cn

 

1. Which of the following HTML elements can we place Javascript code in?

 

Your answer: <script>

2. What is the correct Javascript syntax for writing “Hello World”?

Document. write(“Hello World”)

3. Where is the correct position to insert Javacript?

Your answer: both the <body> part and the <head> part are acceptable

4. What is the correct syntax for referencing an external script named “xxx.js”?

<script SRC =”xxx.js”>

5. Must external scripts contain <script> tags?

Your answer: No

6. How do I write “Hello World” in the warning box?

Alert (“Hello World”)

7. How do I create functions?

Function myFunction()

8. How to call function named “myFunction”?

MyFunction ()

9. How to write a conditional statement that executes some statements when I equals 5?

If (I ==5)

10. How to write conditional statements that execute statements when I is not equal to 5?

Your answer: If (I! = 5)

11. How many different types of loops are there in JavaScript?

Your answer: Two. For loop and while loop.

12. How does the for loop start?

For (I = 0; i <= 5; i++)

13. How do I add comments to JavaScript?

//This is a comment

14. What is the JavaScript syntax for inserting multi-line comments?

解 析 : /*This comment has more than one line*/

15. What is the correct way to define a JavaScript array?

Var TXT = new Array(“George”,”John”,”Thomas”)

16. How do I round 7.25 to the nearest whole number?

Your answer: Math.round(7.25)

17. How do I find the largest number of 2 and 4?

Your answer: math.max (2,4)

18. What is the JavaScript syntax for opening a new window named “window2”?

Your answer: window.open(“www.w3school.com.cn”,”window2″)

19. How do I put a message in the status bar of the browser?

Window. status(“put your message here”) window.status(“put your message here”) window.status(“put your message here”)

Window. status = “put your message here”

20. How do I get the name of the client browser?

Your answer: Navigator.appname