Lecture 21 - JS Review

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

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

View Full Document Right Arrow Icon
CS170 Computer Applications for Business Fall 2008 Instructor: Kristian Stout Lecture 21 Exam 2 Review
Background image of page 1

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

View Full Document Right Arrow Icon
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)
Background image of page 2
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
Background image of page 3

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

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

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

View Full Document Right Arrow Icon
Image of page 6
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 Right Arrow Icon
Ask a homework question - tutors are online