The while loop (a loop executed when a specific condition is met) syntax?
Front
while(variable<=endvalue)
{
code to be executed
}
Back
the last index in a string is?
Front
string.length-1
Back
javascript comment syntax?
Front
/**/ for multiple lines
// for a single line
Back
indexOf() method does?
Front
returns the position of the first found occurrence of a specified value in a string
e.x. string.indexOf(searchstring,start)
x="hello world"
document.write(x.indexOf("world",0))-->7
Back
if a variable is not a function and does not have var then it is?
Front
a global variable
Back
string object methods
Front
...
Back
split() method does what?
Front
splits a string into an array of substring and returns the new array
e.x. string.split(separator,limit)
x="hello world"
document.write(x.split(" ",1))---> hello
Back
javascript syntax for a (limited loop based on specifications) syntax?
Front
for(variable=startvalue;variable<=endvalue;variable=variable+increment)
{
code to be run until loop is complete.
}
an object used to store multiple values in a single variable.
Back
charAt() method does?
Front
returns the character at the specified index
e.x. string.charAt(index)
x="hello world"
document.write(x.charAt(0))-->h
Back
the break and continue statement?
Front
if(i==3)
{
break;
}
breaks loop
if(i==3)
{
continue;
}
breaks loop and restarts at next value;
Back
conditional variable syntax?
Front
z=(x==y)?5:6
z = 5 if x=y;
z = 6 if x!=y;
Back
search() method does what?
Front
searches for a match between a regular expression and the string and returns the position
e.x. string.search(regexp)
x="hello world"
document.write(x.search("wo"))--->7
Back
can variables include other variables?
Front
yes
Back
logical operators?
Front
&& [and]
|| [or]
! [not]
Back
function syntax and purpose?
Front
function functionName(var1,var2,..,var99)
{
some code
}
functions allows scripts to be executed when called.
Back
valueOf() method does what?
Front
returns the primitive value of a string.
e.x. string.valueOf()
x= "Hi!"
document.write(x.valueOf())----> Hi!
validating form fields
ex. <form action="blah.asp" method="post" onsubmit="return checkForm()">
Back
prompt box syntax?
Front
x="prompt("text here","default value");
if(x!="null" && x!="")
{
alert("hello "+x+" how are you today?")
}
Back
substr() does what?
Front
same as substring except uses length as opposed to a stop number
e.x. string.substr(start,length)
x="hello world"
document.write(x.substr(0,4))--->hello
Back
concat() method does?
Front
joins 2 or more strings then returns a copy.
e.x. string.concat(string2)
x="hello world "
y="goodbye world"
document.write(x.concat(y))--> hello world goodbye world
Back
properties of methods defined?
Front
properties - are values associated with an object i.e. length
methods - are actions (functions) that can be performed on objects ie toUpperCase [an uppercase method]
Back
match() method does?
Front
searches for a match between the regexp and a string and returns the matchs
e.x. string.match(regexp)
x="hello world"
document.write(x.match("hello"))-->hello
Back
object based programming what does this mean?
Front
objects have properties & methods for example
{
var txt="Hello World!";
document.write(txt.length)
}
gives the property of length of txt and writes it to the doc which is 12.
Back
replace() method does what?
Front
searches for a regexp or substring and replaces it with a new string.
e.x. string.replace(regexp/substr,newstring)
x="hello world"
document.write(x.replace("hello","goodbye"))-->goodye world
Back
x=x+y is the same as what? or x=x/y?
Front
x+=y or x/=y
Back
toLowerCase() method does what?
Front
converts a string to lowercase letters
e.x. string.toLowerCase()
x="BLAH"
document.write(x.toLowerCase())---->blah
Back
special text insertions?
Front
\' single quote
\" double quote
new line
\r carriage return
\t tab
\b backspace
\f form feed
Back
Is javascript case sensitive?
Front
yes!
Back
slice() method does what?
Front
extracts a part of a string and returns the extracted part in a new string(-1 if null)
e.x. string.slice(begin,end)
x="hello"
document.write(x.slice(0,3))---> hell
Back
fromCharCode() method does what?
Front
converts unicode values into characters [does not use strings]
document.write(string.fromCharCode(72))--> H
Back
types of strings object properties
Front
constructor- returns the function that created the objects prototype.
length- returns the length of characters of a string.
prototype-allows you to add properties and methods to an object.
Back
lastIndexOf() method does what?
Front
returns the position of the last occurence of a specified value in a string.
e.x. string.lastIndexOf(regexp,start)
x="hello world"
document.write(x.lastIndexOf("wo",0))--->7
Back
numerical comparison operators?
Front
x==y [x is equal to y]
x===y [x is exactly equal to y]
!= [not equal to]
> [greater than]
< [less than]
>= [greater than or equal to]
<= [less than or equal to]
function product(a,b)
{
return a*b;
}
alert(product(4,3)) <-- will alert 12
return function gives a value back based on function variables.
Back
for... in statement syntax?
Front
var person={fname:"john",lname:"doe",age:"25"};
var x;
for (x in person)
{
document.write(person[x]+" ");
}
-------
loops through all variables attached to person;
Back
switch statement syntax?
Front
switch(variable)
{
case 1;
code
break;
case "example";
code
break
default;
code
}
Back
making a global (multiple) case insensitive search?
Front
/content goes here/g;
var x = /money/g
Back
substring() does what?
Front
extracts characters from a string between two specified #'s and returns it as a new string. [start at 0]
e.x. string.substring(from,to)
x="hello world"
document.write(x.substring(0,4))--->hello
Back
syntax for line breaks in an alert box?
Front
'/n' + " here"
Back
how to make a case sensitive (single) search?
Front
("w3schools") - case sensitive
(/w3schools/) - case insensitive
/content/;
Back
toUpperCase() method does what?
Front
converts a string to uppercase letters
e.x. string.toUpperCase()
x="blah"
document.write(x.toUpperCase())---->BLAH
Back
charCodeAt() method does?
Front
returns the unicode of the character at a specific index in a string.
e.x. string.charCodeAt(index)
x="hello world"
document.write(x.charCodeAt(0))--->72
Back
Section 2
(50 cards)
reverse() method does?
Front
reverse the order of elements in an array (first is last, last is first)
array.reverse()
x=["1","2","3"]
x.reverse()
document.write(x)-->3,2,1
Back
what does sin() do?
Front
returns the sine of a number (-1 to 1)
Math.sin(number)
document.write(Math.sin(3))-->0.1411
Back
creating a literal array?
Front
var x = ["black","white","red","blue","green"]
Back
LOG10E
Front
base-10 logarithm of E
approx (0.434)
Back
parseInt() does what?
Front
gets a number from a string [not part of the math object]
parseInt(string)
document.write(parseInt("45.1nn"))-->451
document.write(parseInt("45nn"))-->45
Back
LN2 is what?
Front
natural logarithm of 2
approx (0.693)
Back
unshift() method does what?
Front
adds new elements to the beginning of an array and returns new length
array.unshift(ele1,ele2,...,ele99)
x=["1","2","3"]
document.write(x.unshift("4"))-->4
Back
what does exp() method do?
Front
returns the value of a user-defined power to eulers number
Math.exp(number)
document.write(Math.exp(1))-->2.7183
Back
sort() method does what?
Front
sorts the elements of an array (alphabetical default) [changes original]
array.sort(sort function)
x=["a","b","c"]
y=["a","c","b"]
document.write(y.sort())-->a,b,c
Back
the boolean has a default value of?
Front
true
Back
how to access an array?
Front
string[array index]
Back
PI is what?
Front
PI
approx (3.14159)
Back
what does ceil() method do?
Front
rounds a number upwards to the nearest interger and returns the result
Math.ceil(number)
document.write(Math.ceil(2.3))--> 3
Back
Math object methods
Front
...
Back
what does abs() method do?
Front
determines the absolute value of x
Math.abs(x)
document.write(Math.abs(-7))-->7
Back
creating an uncondensed array?
Front
var x = new Array(); //regular array
x[0] = "black";
x[1] = "white";
x[2] = "green";
x[3] = "yellow";
x[4] = "blue";
x[5] = "red";
Back
shift() method does what?
Front
removes the first elements in an array and returns it [alters original]
array.shift()
x=["1","2","3"]
document.write(x.shift())--->1
document.write(x)--->2,3
Back
sort() for numbers?
Front
sorting by numbers is different, using a sort function is necessary.
function sortNumber(a,b)
{
return b-a;// for descending
return a-b;// for ascending
}
Back
7 values that make boolean false
Front
0
-0
null
" "
false
undefined
NaN <-- not a number
Back
what does min() method do?
Front
returns the number with the lowest value
Math.min(x,y,z)
document.write(Math.min(10,5,-1))-->-1
Back
what does the method tan() do?
Front
returns the tangent of a number
Math.tan(number)
document.write(Math.tan(90))-->-1.995
Back
what does sqrt() do?
Front
returns the square root of a number
Math.sqrt(number)
document.write(Math.sqrt(9))-->3
Back
the Math object allows you to?
Front
perform mathematical equations and tasks.
Back
toString() method does what?
Front
converts an array to a string, returns the result
x=["1","2","3"]
document.write(x.toString())-->1,2,3
Back
join() does what?
Front
joins all elements of an array into a string
array.join(seperator)
x=["1","2","3"]
document.write(x.join(" and ")) --> 1 and 2 and 3
Back
what does atan2() method do?
Front
returns the arctangent between positive x-axis and the point
Math.atan2(x,y)
document.write(Math.atan2(8,4))-->1.1071
Back
concat() method does what?
Front
joins 2 or more arrays
array.concat(array2)
Back
SQRT2 is what?
Front
square root of 2
approx (1.414)
Back
parseFloat() does what?
Front
gets a decimal number from a string [not part of the math object]
parseFloat(string)
document.write(parseFloat("45.1nn"))-->45.1
document.write(parseFloat("45nn"))-->45
Back
SQRT1_2 is what?
Front
square root of 1/2
approx (0.707)
Back
what does floor() method do?
Front
rounds a number to down to the nearest interger
Math.floor(number)
document.write(Math.floor(5.3))-->5
Back
what does acos() method do?
Front
returns the arccosine of a number in radians
Math.acos(x)
document.write(Math.acos(0.64))-->0.87629
Back
what does cos() method do?
Front
returns the cosine of a number
Math.cos(number)
document.write(Math.cos(3))-->-0.9899
Back
what does the log() method do?
Front
returns the natural logarithm (base E) of a number
Math.log(number)
document.write(Math.log(2))-->0.6931
Back
what does the random() method do?
Front
returns a random number between 0 and 1 [use .floor() and * to get a higher number]
Math.random()
document.write(Math.random())-->0.57
Back
what does the max() method do?
Front
returns the number with the highest value
Math.max(x,y,z)
document.write(Math.max(10,5,-1))-->10
Back
what does atan() method do?
Front
returns the arctangent of a number in radians
Math.atan(x)
document.write(Math.atan(2))-->1.1071
Back
creating a condensed array?
Front
var x = new array ("white","black","red","green","blue")
//condensed array
Back
what does pow() method do?
Front
returns the value of x to the power of y
Math.pow(x,y)
document.write(Math.pow(4,2))-->16
Back
Math object properties
Front
...
Back
pop() does what?
Front
removes the last element of an array and returns it [alters original]
array.pop()
fruits=["apple","nana","grape","orange"]
document.write(fruits.pop())-->orange
document.write(fruits())-->apple,nana,grape
Back
push() method does what?
Front
adds new elements to an array [alters original]
array.push(ele1,ele2,..,ele99)
x=["1","2","3"]
x.push("4")
document.write(x)-->1,2,3,4
Back
array object methods
Front
...
Back
what does round() method do?
Front
rounds a number to the nearest interget
Math.round(x)
document.write(Math.round(5.5))-->6
document.write(Math.round(5.49))-->5
Back
slice() method does what?
Front
selects a part of an array and returns an array [starts from 0, original not changed]
array.slice(begin,length)
x=["1","2","3"]
document.write(x.slice(0,2))-->1,2
Back
the purpose of the boolean object?
Front
to convert a non-boolean value to a boolean value (true or false) value.
Back
LN10 is what?
Front
natural logarithm of 10
approx (2.302)
Back
valueOf() method does what?
Front
returns the primitive value of an array
array.valueOf()
Back
LOG2E is what?
Front
base-2 logarithm of E
approx (1.442)
Back
e is what?
Front
eulers numbers
approx (2.718)
Back
Section 3
(50 cards)
regexp object methods
Front
...
Back
. meta char does what?
Front
finds a single character (can be used in combination) except newline or other line terminators
x="hello world"
y=/h.l/g
document.write(x.match(y))--> hel
Back
what does the n* quantifier do?
Front
matches any string that contains zero or more occurrences of n
x="hello world"
y=/lo*/g
document.write(x.match(y))--> lo,l
Back
what does the global property do?
Front
specified if the "g" modifier is set
/regexp/g
Back
RegExp modifiers
Front
...
Back
\d meta character does what?
Front
finds a digit from 0-9
x="hell1o world"
y=/\d/g
document.write(x.match(y))--> 1
Back
what does the test() method do?
Front
tests for a match in a string, returns true or false (true if found, false if not)
y=/regexp/
y.test(string)
Back
How do you assign the value from a prompt to a string?
Front
var stringVar = prompt("Text Here");
Back
what does the n{x} quantifier do?
Front
matches any string that contains a sequences of x n's
x="100, 1000 or 10000"
y=/\d{4}/g
document.write(x.match(y))--> 1000,1000
Back
booleans only non-primitve is what?
Front
toString()
boolean.toString()
Back
what does the source property do?
Front
returns the source of the regexp
x=/regexp/gi
document.write(x.source)-->regexp
Back
\W meta character does what?
Front
finds a non-word character
x="hello world!%"
y=/\W/g
document.write(x.match(y))--> !,%
Back
what does the lastIndex property do?
Front
specified the index at which to start the next match [specified character position after last match]
x="string string string"
y=/regexp/gi
while(y.text(x)==true)
{
document.write("i found the index at: " + y.lastIndex)
}
firstmatch index number, second match index number
Back
what does the n{x,y} quantifier do?
Front
matches any string that contains a sequence of X to Y n's [x and y must be #'s]
x="100, 1000 or 10000"
y=/\d{4,5}/g
document.write(x.match(y))--> 1000,10000
Back
\D meta character does what?
Front
used for find a non-digit character
x="hello world9"
y=/\D/g
document.write(x.match(y))--> h,e,l,l,o, ,w,o,r,l,d
Back
\B meta character does what?
Front
find a match that is not at the beginning of a word (or returns null)
x="hello world"
y=/\Borld/g
document.write(x.match(y))--> orld
Back
meta chracter does what?
Front
used to find a newline character (only useful in alert text)
x="hello world"
y=/ /g
document.write(x.search(y))--> 5
Back
what does the n? quantifier do?
Front
matches any string that contains zero or one occurences of n
x="hello world"
y=/lo?/g
document.write(x.match(y))--> lo,l
Back
regexp brackets
Front
find a range of characters
Back
what does the exec() method do?
Front
tests for a match in a string (returns matched text if found null if not)
y=/regexp/
y.exec(string)
Back
finding browsers and app.name?
Front
navigator.appName - name
navigator.appVersion - version #
Back
\s meta character does what?
Front
finds a whitespace chracters
x="hello world "
y=/\s/g
document.write(x.match(y))--> , ,
Back
bracket examples
Front
[new RegExp("[abc]") or /[abc]/]
[abc] - find any character between bracks
[^abc] - find any char not in bracks
[0-9] - find any digit 0-9
[A-Z] - find any char from uppercase A to uppercase Z
[a-z] - find any char from lowercase a to lowercase z
[A-z] - find any char from uppercase A to lowercase Z
(red|blue|green) - find any of the alternations specified
Back
regexp quantifiers
Front
can be used in conjunction with metacharacters
Back
determining if cookies are enabled?
Front
navigator.cookieEnabled - true or false
Back
\w meta character does what?
Front
finds a word character (a-z,A-Z,0-9)
x="hello world!%"
y=/\w/g
document.write(x.match(y))--> h,e,l,l,o, ,w,o,r,l,d
Back
what does the n$ quantifier do?
Front
matches any string with n at the end
x="hello world"
y=/ld$/g
document.write(x.match(y))--> ld
Back
what is a cookie?
Front
a cookie is a variable that is stored on a users computer.
Back
what does the ignoreCase property do?
Front
specified if the "i" modifier is set
/regexp/i
Back
\0 meta character does what?
Front
finds a nul character
Back
can javascript detect a browser type?
Front
yes and version.
Back
What is the command to display a prompt?
Front
prompt("Text Here");
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
\S meta character does what?
Front
used to find a non-whitespace character
x="hello world"
y=/\S/g
document.write(x.match(y))-->h,e,l,l,o,w,o,r,l,d
Back
what does the i modifier do?
Front
performs a case insensitive search
/regexp/i
x="hello world"
y=/world/i
document.write(x.match(y))--> world
Back
what does the n{x,} quantifier do?
Front
matches any string that contains a sequence of atleast X n's [x must be a number]
x="100, 1000 or 10000"
y=/\d{3,}/g
document.write(x.match(y))--> 100,1000,10000
Back
\b meta character does what?
Front
used to find a match at the beginning or end of a word (if none null)
x="hello world"
y=/\bworld/g
document.write(x.match(y))--> world
Back
regexp object properties
Front
...
Back
what does the ^n quantifier do?
Front
matches any string with n at the beginning
x="hello world"
y=/^he/g
document.write(x.match(y))--> he
Back
how is regexp defined?
Front
var patt = new RegExp(pattern,modifiers)
or
var patt = /pattern/modifiers
Back
regexp means what?
Front
regular expression
Back
what does the n+ quantifier do?
Front
matches any string that contains at one n
x="hello world"
y=/w+/g
document.write(x.match(y))--> hello,world
Back
what does the compile() method do?
Front
[edits source]
the compile method is used to compile and recompile a regexp
y=/regexp/
y.compile(regexp,modifier)
Back
what are regexp modifiers?
Front
used to perform case-insensitive and global searches
Back
what does the g modifier do?
Front
performs a global match (instead of stopping at first found)
/regexp/g
x="hello world"
y=/o/g
document.write(x.match(y))--> o,o
Back
regexp metacharacters
Front
are characters with a special meaning
Back
what deos the ?!n quantifier do?
Front
matches any string that is not follwed by specific string n
x="hello world"
y=/hello(?!world)/g
document.write(x.match(y))-->
Back
what does the ?=n quantifier do?
Front
matches any string that is followed by a specific string of n
x="hello world"
y=/hello(?=world)/g
document.write(x.match(y))--> hello
Back
is there a standard that applies to the navigator object?
Front
no, therefore determining browsers becomes quite an ordeal.
Back
what is a regular expression?
Front
an object that describes a pattern of characters
Back
Section 4
(50 cards)
How do you assign the return value of confirm() to a variable?
Front
var answerVar = confirm("Message Text Here");
Back
For radio buttons, how do you get the current checked status of the control?
Front
document.getElementById("radioButtonId").checked;
Back
For textboxes, how do you set focus on the control?
Front
document.getElementById("TextBoxId").focus;
Back
What are the four attributes of the <script> tag?
Front
Type, Src, Charset, and Defer
Back
How do you code an If Else If statement in JavaScript?
Front
if (condition) {
}
else if (condition) {}
Back
How do you create a function in JavaScript?
Front
var functionName = function(param1, param2, paramN) {}
Back
For textboxes, How do you get the current value?
Front
document.getElementById("TextBoxId").value;
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 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 make the browser load a new page using JavaScript?
Front
window.location = "New Web Address Here";
Back
How do you create a Date object in JavaScript?
Front
var dateVar = new Date();
Back
How do you code an If Else statement in JavaScript?
Front
if (condition){
}
else {}
Back
How do you create an Array object in JavaScript?
Front
var arrayVar = new Array();
Back
How do you denote a string in JavaScript
Front
With either single or double quotes surrounding the data
Back
How do you create a function that returns a value in JavaScript?
What is the string escape sequence to start a new line in JavaScript?
Front
Back
How do you assign actions to the window onLoad event?
Front
window.onload = function() {//actions 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
What values can confirm() return?
Front
True or false
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 code a while statement in JavaScript?
Front
while (condition) {}
Back
How do statements end in JavaScript?
Front
With a semicolon ";"
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
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
For checkboxes, how do you get the current checked status of the control?
Front
document.getElementById("checkboxId").checked;
Back
For checkboxes, how do you get the text value of the control?
Front
document.getElementById("checkboxId").value;
Back
How do you test that a variable contains a valid number?
Front
isNaN(varHere); //Returns true or false.
Back
How do you code an If statement in JavaScript?
Front
if (condition) {}
Back
What are the valid characters for an identifier in JavaScript?
Front
Letters, Numbers, Underscores, and Dollar Signs
Back
How do you write text to the current element of the DOM?
Front
document.write("Text Here"); //Remains on current line
Back
How do you view the current web address using JavaScript?
Front
window.location();
Back
Is JavaScript case sensitive?
Front
Yes
Back
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
How do you assign a default value to a prompt?
Front
Using the second parameter. Example: prompt("Enter Age:", "18");
Back
What is the DOM?
Front
Document Object Model
Back
How do you declare a variable in JavaScript?
Front
var variableName;
Back
Section 5
(50 cards)
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
How do you alter the value of the text element in a span tag?
Front
document.getElementById("spanId").firstChild.nodeValue = "New Value";
Back
What is the string escape sequence to insert a double quote in JavaScript?
Front
\"
Back
What is the identity operator for equals?
Front
===
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 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
What is the string escape sequence to insert a carriage return in JavaScript?
Front
\r
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 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 is the string escape sequence to insert a form feed in JavaScript?
Front
\f
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
What is the identity operator for not equal?
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 is the string escape sequence to insert a tab in JavaScript?
Front
\t
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 String object method returns a new string containing the value of the original string but in all upper case?
Front
toUpperCase();
Back
What is the string escape sequence to insert a backslash in JavaScript?
Front
\\
Back
What Math object method is used to return a random number?
Front
Math.random() //Returns a value >= 0.0 but <1.0
Back
How do you create a new Date object?
Front
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds);
Back
What is the string escape sequence to insert a vertical tab in JavaScript?
Front
\v
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 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 Math object method is used to return the absolute value of a given number?
Front
Math.abs(number);
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
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 given number rounded to the next lowest integer value?
Front
Math.floor(number);
Back
What Math object method is used to return the square root of a given number?
Front
Math.sqrt(number);
Back
What Date object method is used to return the number of milliseconds since the start of GMT?
Front
getTime();
Back
What Date object method is used to return a string containing the date?
Front
toDateString();
Back
What String object method is used to get the character at a specified index position?
Front
charAt(position);
Back
What String object method is used to concatenate multiple strings?
Front
concat(var1, var2, varN);
Back
What Number object method is used to round numbers to the specified number of decimal places?
Front
toFixed(digits);
Back
What Date object method is used to return a string containing the date and time?
Front
toString();
Back
What is the string escape sequence to insert a single quote in JavaScript?
Front
\'
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
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 Number object method is used to return a numerical string with the specified number of significant digits?
Front
toPrecision(precision);
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 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
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 Number object method is used to return a number in exponential format with the specified number of decimal places?
Front
toExponential(digits);
Back
What Math object method is used to return a given number raised to a given power?
Front
Math.pow(number, power);
Back
For a text area, how do you set the current value of the control?
How do you access the text element in a <span> tag?
Front
document.getElementById("spanId").firstChild;
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
Section 6
(1 card)
What is arity?
Front
adjective describing how many operands an operator expects