JavaScript Flashcards
Which errors are typically syntax errors and usually cause error alerts?
Load-time errors
Which method converts a string value to uppercase letters?
toUpperCase()
Which methods determines whether a value is a number?
isNaN()
What process combines two text strings using the plus sign?
concatenation
Which method converts a string to its integer equivalent?
parseInt()
What processes a function’s statements?
calling statement
Which type of operator is this?
25 + 75
Arithmetic
Which expression creates an integer value?
var birthYear = 1956
How does a for loop start?
for (i = 0; i <= 5; i++)
Which event occurs when the user moves the mouse pointer over a link, image, or other visible element on a page?
mouseOver
What is a way of changing a variable from one data type to another?
casting
Why is a reference technique used to access the property or method of an object?
dot notation
Which type of operator is this?
myNumber = 25
Assignment
Which operator is used to assign values?
=
Which expression creates a string value?
var name = “Andrew”
What is the actual data values you provide in JS?
literal
Which event occurs when a user clicks the mouse button outside of a particular input field?
blur
What does a one line JS comment look like?
// this
Which data type holds any numeric value used for mathematical operations?
number
Which event occurs when the user highlights the text in a form field?
select
What type of variable is declared within a function and available only from within that function?
local variable
Which method converts a string to its floating point decimal equivalent?
parseFloat()
What is a symbol or character used in expressions to store or evaluate a value?
operator
What is a part of a statement that is evaluated as a value?
expression
How do you declare a function?
function myFunction() {}
What is a self-contained programming component that contains properties and methods?
object
What are key characteristics and features of JavaScript?
an object-based language
based on event-driven model
platform independent
enables quick development
relatively easy to learn
How do you apply inline scripting to an element?
<a>
click here
</a>
Which event occurs when the user modifies the value of a form field?
change
Which event occurs when the user clicks on a link or form element?
click
Which type of operator is this?
25 < 75
Logical
What happens if you define a function but do not call it?
nothing
Which method creates a pop up box with the specified message string and requests user input into the text field in the box?
prompt()
What is a named set of statements that performs a task or calculates a value?
function
How do you call this function?
function myFunction() { return “success”; }
myFunction()
Which event occurs when a page is closed?
unload
Which errors are mathematical, casting errors, errors in proper command usage, or errors in the structure of the script, which result in the script running improperly?
Logic errors
Which technique adds JS to a singe web page within either the or the ?
embedded scripting
Which object allows you to determine information about the user’s browser?
navigator
Which method creates a pop-up box with the specified message string, which the user can dismiss by clicking a button in the box?
alert()
Which property returns a string value indicating the name of the client browser?
navigator.appName
Which technique adds JavaScript to a single HTML element?
Inline scripting
How do you find a number with the highest value of x and y?
Math.max(x,y)
What must variable names begin with?
a letter
the underscore _
the dollar sign $
Which technique adds JS by linking web pages to a text file with the .js file name extension?
external scripting
What is a value or expression containing data or code that is passed on to a function?
argument
How do you round the number 7.25 to the nearest integer?
Math.round(7.25)
Which event occurs when there is a problem loading an external image or resource?
error
What does a JS comment with more than one line look like?
/* like this */
What is a named space of memory?
variable
Which event occurs when a form’s Submit button is clicked?
submit
Which data type holds True or False values only?
Boolean
What are actions that an object can be made to perform?
methods
What type of variable is available throughout the entire script?
global variable
Which value indicates that a variable has no value assigned yet?
undefined
What are attributes of an object (e.g., height, color, font size, sentence length, etc.)?
Properties
What describes when values are passed to a function, and the function’s parameters receive a copy of its arguments values?
function myFunction(x) { return x; }
var num = 2; myFunction(num);
pass by reference
What is the correct way to change the content of the HTML element below?
<p>this is a demo</p>
document.getElementById(“demo”).innerHTML = “Hello World!”;
What is used to output values from a function?
return
Which errors occur after the script has loaded and is running, typically caused by improper use of commands?
Run-time errors
Which type of operator is this?
z == 10
Comparison
Which value indicates that the user enters nothing in a text box then submits the form?
null
Which method creates a pop up box with the specified message string and requests user confirmation by clicking OK or Cancel button in the box?
confirm()
How do you write an if statement if i is not equal to 5?
if (i != 5)
What is the correct syntax to open a new window?
w2 = window.open(“URL”);
Which property returns a string value indicating the version number of the client browser and the platform?
navigator.appVersion
Which event occurs when a page is opened?
load
Which method writes the specified string in the page?
document.write()
Which data type holds any string of alphanumeric characters used for words or for numbered phrases that are not mathematically manipulated?
string
How to write an if statement in JS?
if (i == 5)
Which event occurs when the mouse pointer leaves a link, image, or other visible element on a page?
mouseOut
Which event occurs when a firm’s Reset button is clicked?
reset
Which event occurs when the loading of an image is terminated?
abort
Which event occurs when a user clicks into a form field?
focus
Does JS perform its functionality primarily on the client or server-side?
client side
What describes when values are passed to a function, and the function’s parameters receive its argument’s actual values?
function myFunction(x) { return x; }
myFunction(2);
pass by value
Which type of operator makes decisions in a script?
(a > b) ? a++ : a- -
Conditional
How does a while loop start?
while (i <= 10)