Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function compareValues(listOfTheValues){
- list = listOfTheValues
- var bestValue
- bestValue = list[0]
- // set the bestValue to the first one in the last
- // run through the remainder of the list
- for(var i:int = 1;i<=list.length-1;i++){
- if(list[i] > bestValue){
- bestValue = list[i]
- }
- // if any of the list items are better (greater in this case) than the current bestValue, replace the bestValue
- }
- // return the bestValue once the list has been ran though
- return bestValue
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement