{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 14 - Computer Applications for Business CS170 Fall...

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

View Full Document Right Arrow Icon
CS170 Computer Applications for Business Fall 2008 Instructor: Kristian Stout Lecture 14 Arrays Readings: Chapter 21
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
Topics Useful String Methods Useful Math Methods Arrays
Background image of page 2
Useful String Methods var myString = “Foo Bar”; Changing case - myString.toUpperCase(); //returns string as Upper Case - myString.toLowerCase(); //returns string as Lower Case accessing pieces of the string: - myString.substring(0,2) // returns Fo - myString.indexOf('bar'); // returns 4 if nothing is found it returns -1 - myString.charAt(5); // returns a
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
Background image of page 4
Useful Math Methods var myNum = -1.456; var myNum2 = 1.456; Math.abs(myNum); //returns 1.456 - this returns the absolute value of a number Rounding - Math.round(myNum2) //returns 1 - Math.floor(myNum2) //returns 1 - Math.ceil(myNum2) //returns 2 Math.random() - returns a random number between 0 and 1 eg 0.1213 0.134 0.0563
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
Background image of page 6
Arrays What is an array ? Why do we need them ? Declaration Assignment Index and Value Accessing array elements Types of array Using Arrays with loops Array Examples
Background image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}