JavaScript1
An external JavaScript file commonly uses a filename extension of __________.
.js
Which of the following indicates that more than one line of commentary will follow it within JavaScript code?
/*comments
How can you add a comment in a JavaScript?
//This is a comment
Which of the following indicates that a single line of commentary will follow it within JavaScript code?
//comments
What is the correct syntax for referring to an external script called "xxx.js"?
<script src="xxx.js">
Which of the following correctly points to an external JavaScript file named yourfile.js?
<script type= "text/javascript" src="yourfile.js"></script>
What is added to a Web page to insert JavaScript code?
<script> and </script> HTML tags
Which of the following is something you should have to use JavaScript?
A Web browser
JavaScript was invented by______________ in 1995, and became an_______________ standard in 1997.
Brendan Eich, ECMA
Which of the following indicates the end of a multiple-line JavaScript comment?
Comments*/
document.write(text);
Displays result whether ever in the parentheses as text on the HTML
You must know which of the following to be able to use JavaScript?
HTML
How can a client-side language help when using forms on a Web page?
It can validate the information before it is sent to the server.
What does this code do? <button type="button" onclick="document.getElementById('demo').innerHTML = Date()">name of button.</button> <p id="demo"></p>
It creates a button that when you click it the result displays the current date and time
How do you write "Hello World" in an alert box?
alert("Hello World");
A client-side language is run directly through the __________ being used by the viewer.
client or frontend
When you use multiple-line JavaScript comments, you need to be careful to __________ them.
close
The noscript tag provides __________ for those without __________.
content , JavaScript.
How does a FOR loop start?
for (i = 0; i <= 5; i++)
How to write an IF statement in JavaScript?
if (i == 5)
JavaScript is more __________ than Java in a number of areas, such as syntax.
lenient
In older versions of HTML, the script tag is not case sensitive. However, with XHTML, the script tag must be in __________.
lowercase.
How do you call a function named "myFunction"?
myFunction()
________________is the official name of the standard.
ECMA-262
___________________is the official name of the language.
ECMAScript
JavaScript and Java are the same language.
False
How is JavaScript added to a Web page?
It is added to an HTML document.
The choice of a Web browser is up to you, as long it's compatible with __________.
JavaScript
Before its release as JavaScript, JavaScript was called __________.
LiveScript
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)
In JavaScript, what handles errors in a script?
The Web browser
Why should you use the type attribute in the opening script tag?
To be sure the browser does not interpret your JavaScript as another scripting language and to ensure the Web page validates in XHTML
What is the purpose of the <script> and </script> tags?
To tell the browser where a script begins and ends To let the browser know the scripting language to be used To point to an external JavaScript file All of the above
JavaScript has similarities to other programming and scripting languages.
True
With a scripting language, the code is interpreted as it is loaded in the client.
True
When would it be a good idea to use an external JavaScript file?
When the script is very long or needs to be placed in more than one HTML document
Is JavaScript code case sensitive?
Yes
To write a string of text on a Web page, the __________ method is used.
document.write()
JavaScript comments can be very useful for the purpose of __________ or __________ your code.
documenting or debugging
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)
How can you detect the client's browser name?
navigator.appName
JavaScript is __________.
object based
A __________ language doesn't require a program to be compiled before it is run.
scripting
The __________ signals the end of a JavaScript statement.
semicolon
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)