web dev 2 JS
How do you write "hello world" in an alert box?
Alert("hello world");
What Will the following code return: Boolean(10>9)?
True
How does a FOR loop start?
for (i = 0; i <= 5; i++)
How do you create a function in JavaScript?
function myFunction()
What is the correct way to write a JavaScript array?
var colors = ["red", "green", "blue"]
Which operator is used to assign a value to a variable?
=
How can you add a comment in JavaScript?
//this is a comment
The external JavaScript file must contain the script-tag
False
How can you detect the clients browser name?
navigator.appName
How do you declare a JavaScript variable?
var carName;
What is the correct JavaScript syntax for opening a new window called "w2"?
w2 = window.open("HTTP://w3schools.com");
How does a WHILE loop start?
while (i <= 10)
How to insert a comment that has more than one line?
/ * this comment has more than one line. * /
How do you find the number with the highest value of x and y?
Math.max(x, y)
How do you round the number 7.25, to the nearest integer?
Math.round(7.25)
Which event occurs when the user clicks on an html element?
Onclick
Inside which HTML element do we put the JavaScript?
Script
What is the correct syntax for referring to an external script called "xxx.js"?
Script src="xxx.js"
How to write an IF statement for executing some code if "i" is NOT equal to 5?
if (i != 5)
How to write an IF statement in JavaScript?
if (i == 5)
How do you call a function named "myfunction"?
myFunction()
Where is the correct place to insert a JavaScript?
Both the <head> section and the section are correct
JavaScript is the same as Java.
False
Is javascript case sensitive?
Yes