What Math object method is used to return the absolute value of a given number?
Front
Math.abs(number);
Back
What String object method is used return the position of the first instance of a specified search string, starting from the specified index?
Front
indexOf(searchValue, startPosition); //If no startPosition is specified, the search begins from the start of the string
Back
What makes the identity operators different from the standard equality operators?
Front
They do not perform type coercion. //Eg. If data types don't match they fail the comparison
Back
What Math object method is used to return a given number that has been rounded to the closes integer value?
Front
Math.round(number);
Back
What are the available set methods for a Date object?
Front
setFullYear(); //Sets 4 digit year
setMonth(); //Sets months, starts with 0 for January
setDate(); // Sets day of the month
setHours(); //Sets hours in the day
setMinutes(); //Sets the minutes in the current hour
setSeconds(); //Sets seconds in the current minute
setMilliseconds(); //Sets milliseconds in the current second
Back
How do you access the text element in a <span> tag?
Front
document.getElementById("spanId").firstChild;
Back
What Date object method is used to return a string containing the date and time?
Front
toString();
Back
What are the 3 shortcuts for Number object properties?
Front
Infinity //Represents Number.POSITIVE_INFINITY
-Infinity //Represents Number.NEGATIVE_INFINITY
NaN //Represents Number.NaN
Back
What is the format to create a new Date object from a string?
Front
var dateObject = new Date("11/22/2012 18:25:35");
Back
What String object method returns a new string containing the value of the original string but in all upper case?
Front
toUpperCase();
Back
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?
Front
substring(startIndex, stopIndex); //stopIndex is optional, if it is not specified, then it will go until the end of the string
Back
For radio buttons, how do you set the current checked status of the control?
Front
document.getElementById("radioButtonId").checked = true; //Could also be false
Back
What String object method is used to get the character at a specified index position?
Front
charAt(position);
Back
What Math object method is used to return a given number rounded to the next highest integer value?
Front
Math.ceil(number);
Back
What Number object method is used to return a string with a given number base?
Front
toString(base); //Bases can range from 2 to 36
Back
For checkboxes, how do you set the current checked status of the control?
Front
document.getElementById("CheckboxId").checked = true; //Could also be false
Back
What Math object method is used to return the square root of a given number?
Front
Math.sqrt(number);
Back
For a text area, how do you get the current character count for the control?
Front
var areaText = document.getElementById("textAreaId").value;
var charCount = areaText.length;
Back
What Math object method is used to return the highest value from a set of supplied numbers?
Front
Math.max(var1, var2, varN);
Back
What is the string escape sequence to insert a backslash in JavaScript?
Front
\\
Back
What String object method is used to return a new string that contains part of the original string from the specified start position?
Front
substring(startIndex);
Back
What Math object method is used to return a given number rounded to the next lowest integer value?
Front
Math.floor(number);
Back
What Math object method is used to return the lowest value for a set of supplied numbers?
Front
Math.min(var1, var2, varN);
Back
What String object method returns a new string containing the value of the original string but in all lower case?
Front
toLowerCase();
Back
What is the string escape sequence to insert a tab in JavaScript?
Front
\t
Back
What String object method is used to concatenate multiple strings?
Front
concat(var1, var2, varN);
Back
What is the string escape sequence to insert a carriage return in JavaScript?
Front
\r
Back
How do you create a new Date object?
Front
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds);
Back
What are the available properties for the Number object?
What are the available get methods for a Date object?
Front
getTime();
getFullYear(); //Returns 4 digit year
getMonth(); //Returns months, starts with 0 for January
getDate(); // Returns day of the month
getHours(); //Returns hours in the day
getMinutes(); //Returns the minutes in the current hour
getSeconds(); //Returns seconds in the current minute
getMilliseconds(); //Returns milliseconds in the current second
Back
What Number object method is used to return a number in exponential format with the specified number of decimal places?
Front
toExponential(digits);
Back
What are the events common to most controls?
Front
onfocus //Fired when control receives focus
onblur //Fired when control loses focus
onclick //Fired when the control is clicked
ondblclick //Fired when the control is double clicked
onchange //Fired when the control's value is changed
onselect //Fired when text is selected in a textbox or text area
Back
What is the string escape sequence to insert a form feed in JavaScript?
Front
\f
Back
What Date object method is used to return a string containing the date?
Front
toDateString();
Back
What is the string escape sequence to insert a single quote in JavaScript?
Front
\'
Back
What Date object method is used to return a string containing the time?
Front
toTimeString();
Back
What is the escape sequence used to insert a Unicode character into a string in JavaScript?
Front
\udddd //"dddd" is replaced by the hexadecimal value for the Unicode character
Back
What Number object method is used to round numbers to the specified number of decimal places?
Front
toFixed(digits);
Back
What is the string escape sequence to insert a double quote in JavaScript?
Front
\"
Back
What Math object method is used to return a given number raised to a given power?
For a text area, how do you get the current value of the control?
Front
document.getElementById("textAreaId").value;
Back
What is the string escape sequence to insert a vertical tab in JavaScript?
Front
\v
Back
What Number object method is used to return a numerical string with the specified number of significant digits?
Front
toPrecision(precision);
Back
What are the two methods common to most controls?
Front
focus //Brings focus to the control
blur //Removes focus from the control
Back
How do you concatenate multiple parts into a string?
Front
var stringVar = "part 1:" + "part 2";
Back
What Math object method is used to return a random number?
Front
Math.random() //Returns a value >= 0.0 but <1.0
Back
Section 3
(3 cards)
What is the identity operator for equals?
Front
===
Back
What is the format for a switch statement in JavaScript?
Front
switch (inputVar) {
case "caseSwitch1":
//Operations here
//No break so it cascades to caseSwitch2.
case "caseSwitch2":
//Operations here
break; //Break so it will not continue to cascade down.
}