w3schools JavaScript quiz

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

5. The external JavaScript file must contain the <script> tag. False True

False

10. How to write an IF statement for executing some code if "i" is NOT equal to 5? if (i != 5) if (i <> 5) if i =! 5 then if i <> 5

if (i != 5)

4. What is the correct syntax for referring to an external script called "xxx.js"? <script name="xxx.js"> <script src="xxx.js"> <script href="xxx.js">

<script src="xxx.js">

16. How do you round the number 7.25, to the nearest integer? rnd(7.25) Math.rnd(7.25) Math.round(7.25) round(7.25)

Math.round(7.25)

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!";

12. How does a FOR loop start? for i = 1 to 5 for (i = 0; i <= 5) for (i = 0; i <= 5; i++) for (i <= 5; i++)

for (i = 0; i <= 5; i++)

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

function myFunction()

9. How to write an IF statement in JavaScript? if (i == 5) if i == 5 then if i = 5 if i = 5 then

if (i == 5)

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

myFunction()

20. How can you detect the client's browser name? client.navName navigator.appName browser.name

navigator.appName

14. 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*/

13. 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

21. Which event occurs when the user clicks on an HTML element? onclick onmouseover onmouseclick onchange

onclick

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

true

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

var carName;

15. 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"]

11. How does a WHILE loop start? while (i <= 10; i++) while (i <= 10) while i = 1 to 10

while (i <= 10)


संबंधित स्टडी सेट्स

Musculoskeletal Imaging, Breast & Superficial Structures ch 14 ARRT

View Set

Listening Exercise 2.3, Hearing Major and Minor

View Set

Metric Measurement, Metric Conversion by Kylehase

View Set

What are the three major categories of hormones?

View Set

A Man For All Seasons Quotes & Descriptions

View Set