Shared Flashcard Set

Details

JavaScript Fundamentals
CIW JavaScript Fundamentals
157
Computer Science
Undergraduate 1
11/12/2009

Additional Computer Science Flashcards

 


 

Cards

Term
Variable Data Types
Definition
Number, string, Boolean, null, Object
Term
Number
Definition
any numeric value
Term
String
Definition
Any string of alphanumeric characters
Term
Boolean
Definition
True or false values only
Term
null
Definition
A special keyword for the null value
Term
Object
Definition
a reference to a JavaScript object
Term
Literals
Definition
Actual data values you provide to JavaScript
1.Integer literal
2.Floating-point literal
3.String literal
Term
Rules for naming variables
Definition
1.first character must be a letter or underscore
2.subsequent characters can be letters numbers, and/or unerscore
Term
How do you declare a variable?
Definition
By using the var keyword
Term
True or False: JavaScript is case sensitive
Definition
True
Term
What are the JavaScript Expressions?
Definition
Assignment, Arithmetic, String, Logical
Term
What is Assignment?
Definition
Assigns a value to a variable.
Term
What is the Aritmetic expression
Definition
Evaluates to a number
Term
What is the String expression
Definition
evaluates to a string
Term
What is the Logical expression
Definition
evaluates to true or false
Term
What are Operators?
Definition
Used in expressions to store or return a value.
Term
Operator: =
Definition
Assigns the value of the right operand to the left operand
Term
Operator: +=
Definition
Adds together the operands and assigns the result to the left operand.
Term
Operator: -=
Definition
Subtracts the right operand from the left operand and assigns the result to the left operand.
Term
Operator: *=
Definition
Multiplies together the operands and assigns the result to the left operand.
Term
Operator: /=
Definition
Divides the left operand by the right operand and assigns the result to the left operand.
Term
Operator:%=
Definition
Divides the left operand by the right operand and assigns th remainder to the left operand.
Term
Operator: +
Definition
Adds the operands together.
Term
Operator: -
Definition
Subtracts the right operand from the left operand.
Term
Operator: *
Definition
Multiplies the operands together.
Term
Operator: /
Definition
Divides the left operand by the right operand.
Term
Operator: %
Definition
Divides the left operand by the right operand and calculates the remainder.
Term
Operator: &&
Definition
The logical "and"; evaluates to tru when both operands are true.
Term
Operator: ||
Definition
The logical "or"; evaluates to true when either operand is true.
Term
Operator: !
Definition
The logical "not"; evaluates to true if the operand is false and to false if the operand is true.
Term
Operator:==
Definition
Evaluates to true if the operands are equal.
Term
Operator: !=
Definition
Evaluates to true if the operands are not equal.
Term
Operator: >
Definition
Evaluates to true if the left operand is less than the right operand.
Term
Operator: <
Definition
Evaluates to true if the left operand is less than the right operand
Term
Operator: >=
Definition
Evaluates to true if the left operand is greater than or equal to the right operand.
Term
Operator:<=
Definition
Evaluates to true if the left operand is greater than or equal to the right operand.
Term
Operator: + (string)
Definition
Combines the operands into a single string.
Term
Operator: (condition) ? val1 : val2
Definition
evaluates to one of two different values based on a condition.
Term
Operator: ++
Definition
Increases t he value of the supplied operand by one.
Term
Opeator: - (unary)
Definition
Negates the value of the operand.
Term
Operator: --(unary)
Definition
Decreases the value of the supplied opernad by one.
Term
Functions
Definition
A named block of code that can be called when needed. Can return a value.
Term
How do you define a function?
Definition
When you encompass agroup of script statements into a function block.
Term
What is the syntax for a function?
Definition
function functionName (argument1, argument2,...){
//statements here
}
Term
Argument
Definition
A value or expression containing data or code that is passed on to a function or procedure.
Term
Where do you define all of your functions?
Definition
In the HEAD element of your HTML page.
Term
True or False: Arguments or paremeters, are values passed into a function from outside the function.
Definition
True
Term
What statement returns values to the calling statement.
Definition
The return statement
Term
Where can a value be assigned that is returned from a function?
Definition
A variable or it can be used as an expression.
Term
How do you make a variable local?
Definition
Declare within a function.
Term
How do you make a variable global?
Definition
Declare it outside of a function, usually at the start of a script.
Term
Event: abort
Definition
Occurs when the loading of an image is aborted
Term
Event: blur
Definition
Occus when input focus is removed from a form element.
Term
Event: click
Definition
Occurs when the user clicks on a link or form element
Term
Event: change
Definition
Occurs when a user changes the value of a form field.
Term
Event: error
Definition
Occur when an error takes place while a page or image is loading.
Term
Event: focus
Definition
Occurs when a user gives input or focus to a form element.
Term
Event: load
Definition
Occurs when a page is loaded into the browser.
Term
Event: mouseOver
Definition
Occurs when the user moves the mouse pointer over a link or area object.
Term
mouseOut
Definition
Occurs when the mouse pointer leaves a link or area object.
Term
Event: reset
Definition
Occurs when a form's REset button is clicked.
Term
Event: select
Definition
Occurs when the user slects the text in a form field.
Term
Event: submit
Definition
Occurs when a form's Submit button is clicked.
Term
Event: unLoad`
Definition
Occurs when a page is unloaded from the browser.
Term
onClick
Definition
Button, Reset, Submit, Radio, Checkbox, link, area
Term
onBlur
Definition
Radio, Checkbox, text, textarea, select
Term
onFocus
Definition
Radio, Checkbox, text, textarea, select
Term
onMouseOver
Definition
link, area
Term
onMouseOut
Definition
link, area
Term
form
Definition
onSubmit, onReset
Term
onChange
Definition
text, textarea, select,
Term
pasrInt()
Definition
converts a string to its integer equivalent
Term
parseFloat()
Definition
converts a string to its floating-point decimal equivalent
Term
if...else statement
Definition
gives the ability to branch to one of two processes depending on the result of some test condition that you have scripted.
Term
What is a while statement used for?
Definition
To execute a block of code for as long as a certain test condtion is true.
Term
what does the isNAN() function stand for?
Definition
is not a number
Term
True or False: the do...while statement operates like the while statement
Definition
True
Term
Does the do...while statement check the conditional expression the first time through?
Definition
No
Term
What is "for" statement?
Definition
It repeats a group of statements for some particular range of values.
Term
True or false: the "break" statement exits a loop that would otherwise continue to execute.
Definition
True
Term
What does the "continue" statement do?
Definition
It is used to force the flow of control back to the top of a loop.
Term
True or False: The "continue" statement can be used in an "if...else" statement.
Definition
False
It can only be used inside a "for" or "while" loop.
Term
"A more efficient method for evaluating a large number of test conditions
Definition
the "switch" statement
Term
How do you exit the "switch" statement?
Definition
the "break" statement.
Term
Window Object
Definition
-highest-level object
-represents the frame of the browser and the mechanisms associated with it.
Term
What is used to depict the heirarchy of objects?
Definition
dot.notation
Term
True or False:
the status property refers to the text string displayed in the status bar at the bottom of the browser window
Definition
True
Term
True or False:
the document object is superior to the window object.
Definition
False
Term
What provides the properties and methods to work with many aspects of the current document.?
Definition
the "document" object
Term
True or False:
the document object is defined in the HEAD of the HTML page.
Definition
False:
defined in the BODY tag
Term
What do you statement is made to use several properties and/or methods with a single object?
Definition
the "the" with statement.
Term
Where does the image object reside?
Definition
Beneath the document object.
Term
What are the properties of the "image" object?
Definition
src, height and width, length, lowsrc, complete, hspace and vspace.
Term
What are teh properties and methods of the "history" object
Definition
Properties: length

Methods:back(), forward(), go(x)
Term
True or False" The location is object is subordinate to the windo object.
Definition
True
Term
Properties of "location" object
Definition
href
protocol
host
hostname
port
pathname
search
hash
Term
What is the most common element in any program?
Definition
The string
Term
Do you need to create a formal string object to use string object properties?
Definition
No, javascript is flexible in this regard.
Term
True or False:
the string object provides predefined methods for formatting text.
Definition
True
Term
What are the special characters for string object and what do the do?
Definition
\b backspace
\f form feed
\n new line
\r carriage return
\t tab
\" double quotation mark
\' single quotation mark
\\backslash
Term
This property allows you to create your own methods and properties for the string object
Definition
prototype
Term
Why would you want to test the lenght of a string?
Definition
to validate form submissions such as email addresses or credit card numbers.
Term
True or False:
The indexOf() method returns the index value for the starting position of the last occurrence of the search text specified.
Definition
False:
the indexOf() method tests for the presence of a given character and returns an index value representing the character's position in the string.
Term
Why would you invoke a lastindexOf() method?
Definition
In case you wanted to return the starting position of the LAST occurrence of the search text
Term
What method allows you to examine and extract a portion of a string?
Definition
the substring() method.
Term
what is the generic syntax for the substring() method?
Definition
string.substring(startingIndexPosition, endingIndexPosition);
Term
When would you want to use the charAt()method?
Definition
When you want to extract a character that occurs at a specific position in a string.
Term
What's the generic syntax for the charAt() method?
Definition
string.charAt(indexPosition);
Term
True or False:
Regular expressions provide a mechanism whereby programmers can search for specified patterns in text
Definition
True
Term
What is the name of the object used to invoke regular expressions?
Definition
RegExp
Term
How do regular expressions identify a pattern of text?
Definition
By using a a string of characters and/or symbols.
Term
How do you mark the beginning and the end of a regular expression?
Definition
by using two forward slashes. One placed at the beginning of the expression and one placed at the end.
Term
What string objects methods are used with regular expressions and what do they do?
Definition
split()-splits a string and returns an array of subsrings
replace()- replaces a string text
search()-searches a string of text and returns the index position of a string.
match()-returns an array of matched text instead of an index position.
Term
What is an array?
Definition
a single variable with multiple "slots" for different values.
Term
What are some common Array object methods?
Definition
join()-creates a string of an array's value
reverse()-used to reverse the order of an array's elements.
sort()-arranges the leements of an array in a particular order
Term
True or False:
you can use date and time information through the Array object.
Definition
False:
the only way to use date and time information in JavaScript is through the Date object.
Term
What is the Math object used for?
Definition
It contains properties and methods that help you create advanced mathematical calculations.
Term
Does the Math object hold a value?
Definition
no
Term
What's the basic syntax for capturing the value generated from the Math object?
Definition
var myMathValue = Math.method(value);
Term
button
Definition
scriptable button other than a Submit or Reset button
Term
checkbox
Definition
check box is used to submit a yes/no or true/false option
Term
hidden
Definition
a hidden field containing a name/value pair that is submitted unseen and unchaged by the user.
Term
password
Definition
a single-line text box that displays input as asterisks (***) to mask data entry.
Term
radio
Definition
an option buitton in aset of mutually exclusive option buttons
Term
reset
Definition
a reset button used torestore default values in form elements.
Term
select
Definition
a selection list from which a single choice or multiple choices can be made
Term
submit
Definition
a submit button used to send the contents of a form to a server.
Term
text
Definition
a single-line text field used for data entry
Term
textarea
Definition
a scrolling text box used for data entry.
Term
What two ways can you refer to a form element?
Definition
by its name or by its index number in the form objects elements array.
Term
True or False:
the form object represents the an A++ form in JavaScript
Definition
False:
the form object represents an HTML form in JavaScript
Term
True or False:
Each form on a page is representd by a one all encompassing instance of the form object.
Definition
False:
each form on a page is represented by a seperate instance of the form object.
Term
What are the common properties, methods, and event handlers in the form object
Definition
action-reset()-onReset
elements-submit()-onSubmit
encoding
length
method
name
target
Term
What is the main event handler associated with the checkbox object.
Definition
onClick
Term
What are the commonly used properties,methods and event handlers related to the text and textarea objects?
Definition
defaultValue-blur()-onBlur
form--onChange
name-focus()-onFocus
value-select()-onSelect
Term
What are the commonly used properties, methods and event handlers related to the radio object?
Definition
checked-click()-onClick
defautlChecked
form
length
name
value
Term
what is the select object?
Definition
It is a drop-down list or list box of items used in an HTML form.
Term
What are cookies?
Definition
small pieces of information sent from a server to a client's computer and stored in memory.
Term
How are cookies sent?
Definition
They are sent from a server to a clien't browser in the HTTP response header
Term
Concerning cookies; What two actions occur when a user generates an HTTP request?
Definition
1. any cookies already on the client's system that match the server's domain can be passed along in the request header.
2. a server can send a cookie back in the HTTP response header.
Term
What parameters can be in a cookie?
Definition
name, expires, pat, domain, secure
Term
What does a cookie header look like to your browser?
Definition
Set-Cookie: name=value; expires=date; path=path; domain=domain; secure
Term
Who can send a cookie?
Definition
a server can set, or deposit a cookie only if a user visits that particular site.
Term
How many total cookies can a user have on his/her hard drive?
Definition
300
Term
How many cookies can a domain store on a users hard drive?
Definition
20
Term
How big can a cookie be?
Definition
4 kilobytes
Term
What are common reasons to use cookies?
Definition
-aids use authentication
-store user information
-state maintenance
Term
What is the generic syntax for a cookie?
Definition
document.cookie = "name = value";
Term
How do you clear a cookie?
Definition
add an expiration date that has already passed.
Term
What two ways can you target frames in JavaScript
Definition
1. By target name
2. By the frame's number in the frames array.
Term
What are you targeting when you target the parent frame?
Definition
the file containing the frameset in which the currently selected frame is defined.
Term
How do you change any combination of frames at any time?
Definition
Write a simple function that includes two or more location.href statements.
Term
How do you reference a function or variable stored in a file other than the one from which the function or variable is being called?
Definition
you need the appropriate reference.
example:
relationship.frameName.variableName;
Term
What variable targets documents in other windows?
Definition
floatingWindow
Term
What property is used to open a new window
Definition
opener
Term
What object is used to create custome objects?
Definition
constructor
Term
What does a constructor do?
Definition
It creates an empty template from which real-time objects, called instances can be generated.
Supporting users have an ad free experience!