JavaScript Midterm Exam Flashcards
JavaScript is used to add ______ to web pages.
behavior
True or False?
Browsers begin executing JavaScript only when the entire page has loaded.
False
Add JavaScript to your page with the _____ element.
script
Use the _____ attribute in a tag to link to a separate JavaScript file.
src
JavaScript programs are made up of a series of ______.
algorithms
You can put your JavaScript in two places, ______ in the web page, or you can _____ to a separate file containing your JavaScript from your HTML.
right, link
One of the most common JavaScript statements is a variable declaration, which uses the _____ keyword to declare a new variable and the assignment operator, ____, to assign a value to it.
var, =
True or False?
JavaScript expressions compute values.
True
Three common types of expressions are ____, ______, and _____ expressions.
numeric, string, boolean
______ allow you to make decisions in your code.
if/else
____/____ statements allow you to execute code many times by looping.
while/for
Use ______ instead of alert to display messages to the Console.
console.log
True or False?
Console messages should be used primarily for sending messages to the users.
False
______ is the function provided for getting input from a user. If a user hits cancel instead of inputting data, _____ is returned from the function.
prompt, null
Code that continuously repeats itself without ever ending is called a(n) _______.
infinite loop
What is the ‘And’ Boolean operator in JavaScript symbolized by?
&&
______ is the function used in JavaScript for generating random numbers.
math.random
______ is the function that always rounds numbers down.
math.floor
Boolean operators always result in the values ____ or ______.
true, false
To get a false value from an OR operator (||) both values must be ______.
false
_______ is an English approximation of what your code should do.
psuedocode
What happens if you pass too many arguments to a function in JavaScript?
It ignores the extra arguments and runs perfectly fine.
True or False?
In JavaScript, the return type needs to be declared in the function signature.
False
A variable declared outside of a function is called a _______ variable.
global