JavaScript Quiz

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Is JavaScript case-sensitive?

Yes

How does a FOR loop start?

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

Where is the correct place to insert a JavaScript

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

How do you create a function in JavaScript?

function myFunction()

How to write an IF statement for executing some code if "i" is NOT equal to 5?

if (i != 5)

Which operator is used to assign a value to a variable?

=

How do you call a function named "myFunction"?

myFunction()

How do you write "Hello World" in an alert box?

alert("Hello World");

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

False

How to insert a comment that has more than one line?

/*This comment has more than one line*/

How can you detect the client's browser name?

navigator.appName

What is the correct syntax for referring to an external script called "xxx.js"?

<script src="xxx.js">

Inside which HTML element do we put the JavaScript

<script>

How do you find the number with the highest value of x and y?

Math.max(x, y)

What will the following code return: Boolean(10 > 9)

true

How to write an IF statement in JavaScript?

if (i == 5)

JavaScript is the same as Java.

False

How do you round the number 7.25, to the nearest integer?

Math.round(7.25)

What is the correct JavaScript syntax to change the content of the HTML element below? <p id="demo">This is a demonstration.</p>

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

Which event occurs when the user clicks on an HTML element?

onclick

How do you declare a JavaScript variable?

var carName;

What is the correct way to write a JavaScript array?

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

What is the correct JavaScript syntax for opening a new window called "w2" ?

w2 = window.open("http://www.w3schools.com");

How does a WHILE loop start?

while (i <= 10)

How can you add a comment in a JavaScript?

//This is a comment


Kaugnay na mga set ng pag-aaral

Statistics, Data, and Math Reasoning Quiz

View Set

CIS 3003 - Human-Computer Interaction - Quiz 1

View Set

Ch. 21 Collective Behavior & Social Movements

View Set

Chapter 3 Attending and Empathy Skills

View Set

Ancient Egypt, Ch 4.2 "The Old Kingdom" - Study Guide (Holt)

View Set

Psyc 200 Midterm 1 (Holden Spring 2019)

View Set

Georgia Real Estate - Section 12 Unit 1

View Set