w3schools JavaScript quiz1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

addition operator

+

8. How to insert a comment that has more than one line? /*This comment has more than one line*/ //This comment has more than one line// <!--This comment has more than one line-->

/*This comment has more than one line*/

7. How can you add a comment in a JavaScript? 'This is a comment <!--This is a comment--> //This is a comment

//This is a comment

How can we separate JavaScript Statement's

;

1. Inside which HTML element do we put the JavaScript? <scripting> <script> <js> <javascript>

<script>

Assignment Operator

=

4. How do you write "Hello World" in an alert box? alertBox("Hello World"); alert("Hello World"); msgBox("Hello World"); msg("Hello World");

alert("Hello World");

2. What is the correct JavaScript syntax to change the content of the HTML element below? <p id="demo">This is a demonstration.</p> document.getElement("p").innerHTML = "Hello World!"; #demo.innerHTML = "Hello World!"; document.getElementByName("p").innerHTML = "Hello World!"; document.getElementById("demo").innerHTML = "Hello World!";

document.getElementById("demo").innerHTML = "Hello World!";

5. How do you create a function in JavaScript? function = myFunction() function myFunction() function:myFunction()

function myFunction()

6. How do you call a function named "myFunction"? myFunction() call function myFunction() call myFunction()

myFunction()

11. Which operator is used to assign a value to a variable? x = - *

=

3. Where is the correct place to insert a JavaScript? The <body> section Both the <head> section and the <body> section are correct The <head> section

Both the <head> section and the <body> section are correct

13. Is JavaScript case-sensitive? No Yes

Yes

12. What will the following code return: Boolean(10 > 9) true false NaN

true

10. How do you declare a JavaScript variable? var carName; v carName; variable carName;

var carName;

9. What is the correct way to write a JavaScript array? var colors = (1:"red", 2:"green", 3:"blue") var colors = "red", "green", "blue" var colors = ["red", "green", "blue"] var colors = 1 = ("red"), 2 = ("green"), 3 = ("blue")

var colors = ["red", "green", "blue"]


Set pelajaran terkait

Life Policy Provisions, Riders, and Options

View Set

MIS 3353 - Multi-Table SQL & Compounding Data

View Set

Troubleshooting High-Speed Data Service

View Set

MUS 306 Exam 1 (Chapters 1/2/Notes)

View Set

Topic 9 - Requirements of an Insurable Risk

View Set

Missouri Statutes, Rules and Regulations Pertinent to Life Only: Practice Questions

View Set

Saunders: Maternal nursing questions

View Set