Last active
December 3, 2016 18:45
-
-
Save danielkhan/0112ba41ee8b5195ac17014ed0e0969f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var numbers = [12, 22, 45, 13, 66, 1, 100, 1, 210, 10, 11]; | |
| var max = 0; | |
| for (var i = 0;i < numbers.length; i++){ | |
| console.log(`numbers.length is ${numbers.length}, i is ${i}, numbers at position ${i} is ${numbers[i]}`); | |
| console.log(`Now we test if ${max} is lower than ${numbers[i]}`); | |
| if(max < numbers[i]){ | |
| console.log(`I is lower, so now ${numbers[i]} is the new max.`); | |
| max = numbers[i]; | |
| console.log(`Max is now ${max}`); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment