Page does not exist.
Missing Page
Sorry. The page that you requested does not exist on the Department of Computer Science web site.
[an error occurred while processing this directive]
File: index.shmtl
Creator: George Ferguson
Created: Tue Oct 23 14:10:16 2012
Time-stamp: Sorry. The page that you requested does not exist on the Department of Computer Science web site.
Demonstrate your function on a page that asks the user for a
color name and returns the index of that color in an array
containing the
17 predefined CSS color names (in row order top-to-bottom, then
left-to-right within a row).
On to Part 2 when it is available...
Last update: Tuesday, 23-Oct-2012 14:52:41 EDT
Page does not exist.
Missing Page
[an error occurred while processing this directive]
CSC170: Introduction to Programming and the Web
Fall 2012
[an error occurred while processing this directive]
Assignment 7: Arrays and Builtins: Part 1
indexOf
. That is, write a function that takes as
parameters an array and a value and returns the index of the first
element that is equal to the value, or -1 if the value is not one
of the elements in the array.
function copyArray(a) {
return a;
}
59 74 76 26 86 89 21 74 39 83
89 -35 11 -14 -31 -40 73 -40 -29 -81
Things to think about
a[i]
) can
be used in expressions like any other (scalar) variable.