• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/105

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

105 Cards in this Set

  • Front
  • Back
What is the command to display a prompt?
prompt("Text Here");
How do you assign the value from a prompt to a string?
var stringVar = prompt("Text Here");
How do you assign the value from a prompt to a non-string variable?
Using a parse. Example : var intVar = parseInt(prompt("Text Here"));
How do you assign a default value to a prompt?
Using the second parameter. Example: prompt("Enter Age:"
How do you display an alert?
alert("Alert Text Here");
How do you test that a variable contains a valid number?
isNaN(varHere); //Returns true or false.
How do you display a confirmation?
confirm("Message Text Here");
What values can confirm() return?
True or false
How do you assign the return value of confirm() to a variable?
var answerVar = confirm("Message Text Here");
How do you access a page element by id?
document.getElementById(id);
How do you assign actions to the window onLoad event?
window.onload = function() {//actions here}
What are the four attributes of the <script> tag?
Type
In the <script> tag
how is the Type attribute used?
In the <script> tag
how is the Src attribute used?
In the <script> tag
how is the Defer attribute used?
What is the <noscript> tag used for?
The text between the opening and closing tag is displayed if JavaScript is disabled or otherwise not available
How do you write a line to the current element of the DOM?
document.writeln("Text Here"); //Advances to new line after text
What is the DOM?
Document Object Model
What is AJAX?
Asynchronous JavaScript And XML
Is JavaScript case sensitive?
Yes
How do statements end in JavaScript?
With a semicolon ";"
How do you create a single line comment in JavaScript?
With two forward slashes "//"
How do you create a multi-line comment in JavaScript?
Start with a forward slash and asterisk
What are the valid characters for an identifier in JavaScript?
Letters
How do you denote a string in JavaScript
With either single or double quotes surrounding the data
What is the string escape sequence to start a new line in JavaScript?
\n
How do you declare a variable in JavaScript?
var variableName;
How do you create a Date object in JavaScript?
var dateVar = new Date();
How do you create an Array object in JavaScript?
var arrayVar = new Array();
How do you view the current web address using JavaScript?
window.location();
How do you make the browser load a new page using JavaScript?
window.location = "New Web Address Here";
How do you write text to the current element of the DOM?
document.write("Text Here"); //Remains on current line
What method allows you to set the digit precision of a decimal number?
toFixed(digitCount);
For textboxes
How do you get the current value?
For textboxes
How do you set the control to be disabled?
For textboxes
how do you set focus on the control?
How do you code an If statement in JavaScript?
if (condition) {}
How do you code an If Else statement in JavaScript?
if (condition){
How do you code an If Else If statement in JavaScript?
if (condition) {
How do you code a while statement in JavaScript?
while (condition) {}
How do you code a for statement in JavaScript?
for (counter; condition; incrementor) {}
How do you create a function in JavaScript?
var functionName = function(param1
How do you create a function that returns a value in JavaScript?
var functionName = function(param1
What is an event handler?
A function that is called with a certain event occurs. Examples of these include button.onclick and window.onload.
How do you code a button.onclick event handler?
document.getElementById("ButtonId").onclick = functionName;
For radio buttons
how do you get the text value of the control?
For radio buttons
how do you get the current checked status of the control?
For checkboxes
how do you get the text value of the control?
For checkboxes
how do you get the current checked status of the control?
For lists
how do you get the value or the currently selected item?
For a text area
how do you get the current value of the control?
For a text area
how do you get the current character count for the control?
What are the two methods common to most controls?
focus //Brings focus to the control
What are the events common to most controls?
onfocus //Fired when control receives focus
How do you concatenate multiple parts into a string?
var stringVar = "part 1:" + "part 2";
How do you access the text element in a <span> tag?
document.getElementById("spanId").firstChild;
How do you alter the value of the text element in a span tag?
document.getElementById("spanId").firstChild.nodeValue = "New Value";
For radio buttons
how do you set the current checked status of the control?
For checkboxes
how do you set the current checked status of the control?
For a text area
how do you set the current value of the control?
What are the available properties for the Number object?
Number.MAX_VALUE
What are the 3 shortcuts for Number object properties?
Infinity //Represents Number.POSITIVE_INFINITY
What Number object method is used to round numbers to the specified number of decimal places?
toFixed(digits);
What Number object method is used to return a string with a given number base?
toString(base); //Bases can range from 2 to 36
What Number object method is used to return a number in exponential format with the specified number of decimal places?
toExponential(digits);
What Number object method is used to return a numerical string with the specified number of significant digits?
toPrecision(precision);
What is the syntax of a conditional operator?
(Condition_Expression) ? Value_If_True : Value_If_False;
What Math object method is used to return the absolute value of a given number?
Math.abs(number);
What Math object method is used to return a given number that has been rounded to the closes integer value?
Math.round(number);
What Math object method is used to return a given number rounded to the next highest integer value?
Math.ceil(number);
What Math object method is used to return a given number rounded to the next lowest integer value?
Math.floor(number);
What Math object method is used to return a given number raised to a given power?
Math.pow(number
What Math object method is used to return the square root of a given number?
Math.sqrt(number);
What Math object method is used to return the highest value from a set of supplied numbers?
Math.max(var1
What Math object method is used to return the lowest value for a set of supplied numbers?
Math.min(var1
What Math object method is used to return a random number?
Math.random() //Returns a value >= 0.0 but <1.0
What is the string escape sequence to insert a tab in JavaScript?
\t
What is the string escape sequence to insert a carriage return in JavaScript?
\r
What is the string escape sequence to insert a form feed in JavaScript?
\f
What is the string escape sequence to insert a vertical tab in JavaScript?
\v
What is the string escape sequence to insert a double quote in JavaScript?
\"
What is the string escape sequence to insert a single quote in JavaScript?
\'
What is the string escape sequence to insert a backslash in JavaScript?
\\
What is the escape sequence used to insert a Unicode character into a string in JavaScript?
\udddd //"dddd" is replaced by the hexadecimal value for the Unicode character
What String object method is used to get the character at a specified index position?
charAt(position);
What String object method is used to concatenate multiple strings?
concat(var1
What String object method is used return the position of the first instance of a specified search string
starting from the specified index?
What String object method is used to return a new string that contains part of the original string from the specified start position?
substring(startIndex);
What String object method is used to return a new string that contains part of the original string from the specified start position and up to but not including the specified stop index?
substring(startIndex
What String object method returns a new string containing the value of the original string but in all upper case?
toUpperCase();
What String object method returns a new string containing the value of the original string but in all lower case?
toLowerCase();
How do you create a new Date object?
var dateObject = new Date(year
What is the format to create a new Date object from a string?
var dateObject = new Date("11/22/2012 18:25:35");
What Date object method is used to return the number of milliseconds since the start of GMT?
getTime();
What are the available get methods for a Date object?
getTime();
getMonth(); //Returns months
starts with 0 for January
What are the available set methods for a Date object?
setFullYear(); //Sets 4 digit year
setMonth(); //Sets months
starts with 0 for January
What Date object method is used to return a string containing the date and time?
toString();
What Date object method is used to return a string containing the date?
toDateString();
What Date object method is used to return a string containing the time?
toTimeString();
What makes the identity operators different from the standard equality operators?
They do not perform type coercion. //Eg. If data types don't match they fail the comparison
What is the identity operator for equals?
===
What is the identity operator for not equal?
!==
What is the format for a switch statement in JavaScript?
switch (inputVar) {