- Shuffle
Toggle OnToggle Off
- Alphabetize
Toggle OnToggle Off
- Front First
Toggle OnToggle Off
- Both Sides
Toggle OnToggle Off
Front
How to study your flashcards.
Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key
Up/Down arrow keys: Flip the card between the front and back.down keyup key
H key: Show hint (3rd side).h key
![]()
PLAY BUTTON
![]()
PLAY BUTTON
![]()
15 Cards in this Set
- Front
- Back
|
JavaScript Objects
|
Array
Boolean Date Math Number String RegExp |
|
Browser Objects
|
Window
Navigator Screen History Location |
|
Major DOM Objects
|
Document
Events Elements |
|
Ways to Create an Array
|
1.
var myCars=new Array(); // regular array (add an optional integer myCars[0]="Saab"; // argument to control array's size) myCars[1]="Volvo"; myCars[2]="BMW"; 2. var myCars=new Array("Saab","Volvo","BMW"); // condensed array 3. var myCars=["Saab","Volvo","BMW"]; // literal array |
|
Is "var" optional?
myObj = 1; same as ? var myObj = 1; |
They mean different things. If you use var the variable is declared within the scope you are in (e.g. of the function). If you don't use var, the variable is automatically global, and attached to the global object (window, if you are doing it in the browser).
|
|
If...else if...else Statement
|
if (condition1)
{ code to be executed if condition1 is true } else if (condition2) { code to be executed if condition2 is true } else { code to be executed if condition1 and condition2 are not true } |
|
Switch Statement
|
switch(n)
{ case 1: execute code block 1 break; case 2: execute code block 2 break; default: code to be executed if n is different from case 1 and 2 } |
|
How to Define a Function
|
function functionname(var1,var2,...,varX)
{ some code } |
|
The for Loop
|
for (var=startvalue;var<=endvalue;var=var+increment)
{ code to be executed } |
|
The while Loop
|
while (var<=endvalue)
{ code to be executed } |
|
The break Statement
|
var i=0;
for (i=0;i<=10;i++) { if (i==3) { break; } document.write("The number is " + i); document.write("<br />"); } |
|
For...In Statement
|
for (variable in object)
{ code to be executed } |
|
The try...catch Statement
|
try
{ //Run some code here } catch(err) { //Handle errors here } |
|
The Throw Statement
|
throw(exception)
The exception can be a string, integer, Boolean or an object. |
|
Insert Special Characters
|
var txt="We are the so-called \"Vikings\" from the north.";
|