Section 1

Preview this deck

How do you create a multi-line comment in JavaScript?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

4 years ago

Date created

Mar 1, 2020

Cards (103)

Section 1

(50 cards)

How do you create a multi-line comment in JavaScript?

Front

Start with a forward slash and asterisk, and then end with an asterisk and forward slash. "/" "/"

Back

What method allows you to set the digit precision of a decimal number?

Front

toFixed(digitCount);

Back

How do you test that a variable contains a valid number?

Front

isNaN(varHere); //Returns true or false.

Back

For textboxes, How do you set the control to be disabled?

Front

document.getElementById("TextBoxId").disabled = true; //Could also be false to enable it

Back

How do you create a function that returns a value in JavaScript?

Front

var functionName = function(param1, param2, paramN) { //Other steps return returnValue; }

Back

What values can confirm() return?

Front

True or false

Back

For radio buttons, how do you get the text value of the control?

Front

document.getElementById("radioButtonId").value;

Back

How do you denote a string in JavaScript

Front

With either single or double quotes surrounding the data

Back

For textboxes, how do you set focus on the control?

Front

document.getElementById("TextBoxId").focus;

Back

How do you create an Array object in JavaScript?

Front

var arrayVar = new Array();

Back

How do you view the current web address using JavaScript?

Front

window.location();

Back

How do you code an If Else If statement in JavaScript?

Front

if (condition) { } else if (condition) {}

Back

What is the string escape sequence to start a new line in JavaScript?

Front


Back

How do you access a page element by id?

Front

document.getElementById(id);

Back

How do you code an If Else statement in JavaScript?

Front

if (condition){ } else {}

Back

How do you display a confirmation?

Front

confirm("Message Text Here");

Back

What are the valid characters for an identifier in JavaScript?

Front

Letters, Numbers, Underscores, and Dollar Signs

Back

For textboxes, How do you get the current value?

Front

document.getElementById("TextBoxId").value;

Back

How do you assign the return value of confirm() to a variable?

Front

var answerVar = confirm("Message Text Here");

Back

How do you assign actions to the window onLoad event?

Front

window.onload = function() {//actions here}

Back

How do you assign the value from a prompt to a string?

Front

var stringVar = prompt("Text Here");

Back

For radio buttons, how do you get the current checked status of the control?

Front

document.getElementById("radioButtonId").checked;

Back

How do you code a while statement in JavaScript?

Front

while (condition) {}

Back

How do you display an alert?

Front

alert("Alert Text Here");

Back

How do you assign a default value to a prompt?

Front

Using the second parameter. Example: prompt("Enter Age:", "18");

Back

How do you code a for statement in JavaScript?

Front

for (counter; condition; incrementor) {}

Back

How do you assign the value from a prompt to a non-string variable?

Front

Using a parse. Example : var intVar = parseInt(prompt("Text Here"));

Back

How do you create a function in JavaScript?

Front

var functionName = function(param1, param2, paramN) {}

Back

What is an event handler?

Front

A function that is called with a certain event occurs. Examples of these include button.onclick and window.onload.

Back

Is JavaScript case sensitive?

Front

Yes

Back

For checkboxes, how do you get the text value of the control?

Front

document.getElementById("checkboxId").value;

Back

What is the command to display a prompt?

Front

prompt("Text Here");

Back

How do you write a line to the current element of the DOM?

Front

document.writeln("Text Here"); //Advances to new line after text

Back

In the <script> tag, how is the Defer attribute used?

Front

<script defer="defer"> //Used to ensure the code doesn't run until the rest of the page has been loaded

Back

How do you create a Date object in JavaScript?

Front

var dateVar = new Date();

Back

In the <script> tag, how is the Src attribute used?

Front

<script src="fileName.js"> //Used to denote external file for script use

Back

What are the four attributes of the <script> tag?

Front

Type, Src, Charset, and Defer

Back

For checkboxes, how do you get the current checked status of the control?

Front

document.getElementById("checkboxId").checked;

Back

What is AJAX?

Front

Asynchronous JavaScript And XML

Back

In the <script> tag, how is the Type attribute used?

Front

<script type="text/javascript"> //Used to denote the type of script being used. Always this for JavaScript

Back

How do you declare a variable in JavaScript?

Front

var variableName;

Back

How do statements end in JavaScript?

Front

With a semicolon ";"

Back

What is the <noscript> tag used for?

Front

The text between the opening and closing tag is displayed if JavaScript is disabled or otherwise not available

Back

For lists, how do you get the value or the currently selected item?

Front

document.getElementById("listId").value;

Back

How do you create a single line comment in JavaScript?

Front

With two forward slashes "//"

Back

How do you write text to the current element of the DOM?

Front

document.write("Text Here"); //Remains on current line

Back

What is the DOM?

Front

Document Object Model

Back

How do you make the browser load a new page using JavaScript?

Front

window.location = "New Web Address Here";

Back

How do you code an If statement in JavaScript?

Front

if (condition) {}

Back

How do you code a button.onclick event handler?

Front

document.getElementById("ButtonId").onclick = functionName;

Back

Section 2

(50 cards)

What Date object method is used to return the number of milliseconds since the start of GMT?

Front

getTime();

Back

How do you alter the value of the text element in a span tag?

Front

document.getElementById("spanId").firstChild.nodeValue = "New Value";

Back

For a text area, how do you set the current value of the control?

Front

document.getElementById("textAreaId").value = "Text Value";

Back

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?

Front

Number.MAX_VALUE Number.MIN_VALUE Number.POSITIVE_INFINITY Number.NEGATIVE_INFINITY Number.NaN

Back

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?

Front

Math.pow(number, power);

Back

What is the syntax of a conditional operator?

Front

(Condition_Expression) ? Value_If_True : Value_If_False;

Back

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. }

Back

What is the identity operator for not equal?

Front

!==

Back