Created
September 10, 2016 17:43
-
-
Save dengjonathan/e51c79e76d25f05b04cd70dc342b40e8 to your computer and use it in GitHub Desktop.
for loop
This file contains 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 i; | |
var names = ['jon', 'jane', 'jack']; | |
// imperative programming | |
for (i = 0; i < names.length; i++) { | |
names[i] = names[i][0].toUpperCase() + names[i].slice(1); | |
} | |
console.log(names) // ['Jon', 'Jane', 'Jack'] | |
console.log(i) // 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment