JavaScript Flashcards
Which method converts a string value to uppercase letters?
toUpperCase()
Which event occurs when the loading of an image is terminated?
abort
Which event occurs when a user clicks the mouse button outside of a particular input field?
blur
Which event occurs when the user clicks on a link or form element?
click
Which event occurs when a user modifies the value of a form field?
change
Which event occurs when there is a problem loading an external image or resource?
error
Which event occurs when a user clicks into a form field?
focus
Which event occurs when a page is opened?
load
Which event occurs when the user moves the mouse pointer over a link, image or other visible element on a page?
mouseOver
Which event occurs when the mouse pointer leaves a link, image or other visible element on a page?
mouseOut
Which event occurs when a form’s Reset button is clicked?
reset
Which event occurs when the user highlights the text in a form field?
select
Which event occurs when a form’s Submit button is clicked?
submit
Which event occurs when a page closed?
unload
What are attributes of an object, such as height, color, font size, sentence length and so forth?
properties
What are actions that an object can be made to perform?
methods
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 method creates a pop-up box with the specified message string and requests user input into a text field in the box?
prompt()
Which method creates a pop-up box with the specified message string and requests user confirmation by clicking the OK or Cancel button in the box?
confirm()
Which method writes the specified message string in the page?
document.write()
What is a named space of memory?
variable
Which operator is used to assign values?
=
Which data type holds any numeric value used for mathematical operations?
number
Which data type holds any string of alphanumeric characters used for words or for numbered phrases that are not mathematically manipulated?
string
Which expression creates a string value?
var birthYear = “1956”
The quotes around 1956 make it a string value.
Which expression creates an integer value?
var birthYear = 1956
If 1956 had quotes around it, it would no longer be an integer, it would become a string.
Which data type holds True or False values only?
Boolean
Which value indicates that a user enters nothing in a text box then submits the form?
null
Which value indicates that a variable has no value assigned yet?
undefined
What is a part of a statement that is evaluated as a value?
expression
What is a symbol or character used in expressions to store or evaluate a value?
operator
Which type of operator assigns a value to a variable using the equal symbol?
Example: myNumber = 25
Assignment
Which type of operator evaluates to a number?
Example: 25 + 75
Arithmetic
Which type of operator will evaluate to true or false?
Example: 5 != 15
Logical
Which type of operator compares two values and returns a true or false value?
Example: z == 10
Comparison
Which type of operator makes decisions in a script?
Example: (a > b) ? a++ : a–
Conditional
What process combines text strings using the plus sign?
Example: “hello” + “world”
concatenation
What is a named set of statements that performs a task or calculates a value?
function
let x = myFunction(4, 3);
function myFunction(a, b) {
return a * b;
}
How do you declare a function?
function myFunction(parameter1, parameter2) {
// code to be executed
}
What processes a function’s statements?
calling statement
What happens if you define a function but do not call it?
nothing
What is the name of this function?
function myFunction(){
return “success”;
}
myFunction()
What is used to output values from a function?
return
What type of variable is declared within a function and available only from within that function?
local variable
What type of variable is available throughout the entire script?
global variable
What is a value or expression containing data or code that is passed on to a function?
argument
What describes when values are passed to a function, and the function’s parameters receive a copy of its argument’s value?
Example:
function myFunction(x){
return x;
}
var num = 2;
myFunction(num);
pass by reference
What describes when values are passed to a function, and the function’s parameters receive its argument’s actual value?
Example:
function myFunction(x){
return x;
}
myFunction(2);
pass by value
Which method determines whether a value is a number?
isNaN()
Which method converts a string to its integer equivalent?
parseInt()
Which method converts a string to its floating-point decimal equivalent?
parseFloat()
Which errors are typically syntax errors and usually cause error alerts?
Load-time errors
Which errors occur after the script has loaded and is running, typically caused by improper use of commands?
Run-time errors
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
What is the actual data values you provide in JavaScript?
literal
What is a self-contained programming component that contains properties and methods?
object
What is a reference technique used to access a property or method of an object?
dot notation
What are key characteristics and features of JavaScript?
an object-based language
based upon an event-driven model
is platform-independent
enables quick development
is relatively easy to learn
Does JavaScript perform its functionality primarily on the client or server-side?
client side
Which technique adds JavaScript to a single web page within either the <head> or <body>?
embedded scripting
Which technique adds JavaScript to a single HTML element?
inline scripting
Which technique adds JavaScript by linking web pages to a text file with the .js file name extension?
external scripting
How do you apply inline scripting to an element?
<a href=”#” onMouseOver=”helloFunction();”>Click Here</a>
What must variable names begin with?
a letter,
the underscore ( _ ), or
the dollar sign ( $ )
A variable cannot begin with a number!
Are these variables the same or unique?
var Result
var result
var RESULT
unique
Which object allows you to determine information about the user’s browser?
navigator
Which property returns a string value indicating the name of the client browser?
navigator.appName
Which property returns a string value indicating the version number of the client browser, as well as the client’s platform?
navigator.appVersion
What is the value of myVar after execution?
function counter(x) {
return x + 1;
}
var myVar = 0;
counter(myVar);
alert(myVar);
0
What will the alert box display?
var subTotal = 1;
var tax = 0.03;
alert(“The total is “ + subTotal * (1 + tax));
The total is 1.03