Lecture 21 - JS Review

# Lecture 21 - JS Review - Computer Applications for Business...

This preview shows pages 1–6. Sign up to view the full content.

CS170 Computer Applications for Business Fall 2008 Instructor: Kristian Stout Lecture 21 Exam 2 Review

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sample Value Tracing Given the Code: var b,c; var b = 2; var c = 1; c = b++; // c=b; b = b+1; b = 10 + c--; //b = 10+c; c = c-1; what are the values of: b = ___________ (12) c = ___________ (1)
Sample Fill in the Code Create an array to hold the first five even numbers (starting at 0). Use a loop to fill this array with the first five even numbers. Finally, print the fifth even number to the screen. Note: You do not need to be concerned with formatting the output. Just print the number. A possible answer: var evenNumbers = new Array(5); var currentEvenNumber = 0; for( var i = 0; i < 5; i++ ) { evenNumbers[i] = currentEvenNumber; currentEvenNumber += 2; } document.write( evenNumbers[4] ); //prints out 8, the fifth even number

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Given: if( <CONDITION>) { alert(‘I work’); } a) write a condition that triggers the alert when x is more than 10
Sample Multiple Choice Which of these is syntactically invalid javascript? A) var i=0; i += -1*i;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 28

Lecture 21 - JS Review - Computer Applications for Business...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online