DHTML
JavaScript Programming Fundamentals
Review Answers
- Why is it a good idea to comment your code?
You may want to remember what you did at some point in the future. Commenting your code is like writing notes to yourself. It is also a good idea if someone else will be working with your code. - What do methods do?
Methods allow you to tell an object to do something. - What is an event handler?
It allows JavaScript to recognize user events, like a mouse click, and then it allows you to specify what will happen when an event occurs. - How does JavaScript separate things like objects, properties and methods?
It separates them with a dot (.). This is referred to as "dot syntax". - What does the
alert()method do?
It pops up a box with either some text, or the contents of a variable, and an "OK" button. - How can you tell the browser to ignore a character in JavaScript?
By using the escape character (\). - What is the difference between declaring a variable and assigning it a value?
Assigning a variable a value puts something into the variable. A variable is declared when it first shows up in the script. You can declare a variable without assigning it a value. - What can variables contain?
Text strings, numeric values, or boolean values. - How can you turn an existing variable into a string?
By using the String(some_variable) method. - What does the JavaScript
prompt()method allow you to do?
It allows you to get information from the user, in the form of a text string. - What does
indexOf()do?
It searches a string for whichever character is contained inside the parentheses. - What does
substring()do?
It returns the part of the string specified by the start and end positions inside the parentheses. - How can you increment a variable by one?
By using the ++ operator. - What do comparison operators do?
They compare 2 values together, and return a value of true or false. - What part of an expression will JavaScript give precedence to?
It will give precedence to whatever is enclosed in parentheses. - When will the part of the conditional inside the curly braces be run?
When the result of the comparison expression is true. - What does the
parseInt()global function do?
It is used to convert a string to a number (integer). - What do the built in parameters of the
forloop do?- The first parameter specifies the initial value of the counter variable.
- The second parameter test to see if a condition is true.
- The third parameter is used to increment or decrement the variable.
- What is the
confirm()method used for?
It is used to get a yes or no answer from the user, and returns true or false depending on the answer. - How are functions useful when programming JavaScript?
They allow you to run the same code over and over again, as needed. They also only run when called. - What are function parameters?
They are usually variables that are passed to the function when it is called. - What is a local variable?
It is a variable the is declared inside the function, and cannot be accessed outside the function. - What is an array?
An array is a variable that contains a list of items. - How can arrays be used with
forloops?
Theforloop can be used to loop through the items in the array until the end of the array is reached. - What are built in arrays?
Many elements of a page are automatically part of an array. This is called an internal array.
Coming Soon:
- Feb 13
- ISSD 24 - XML
- Feb 21
- ISSD 23 - Web 2.0 Technology
- Feb 23
-
Facebook for Business
Hours: 2
Cost: Free!
- Feb 25
-
Search Engine Optimization (SEO)
Hours: 2
Cost: Free!
- Feb 25
-
Search Engine Marketing (SEM)
Hours: 2
Cost: Free!
- Mar 05
- ISSD 23 - Ajax
DHTML - TOC - Introduction - Books -
JavaScript Programming Fundamentals - Links - [ Answers ] -
Questions -
