This is very similar to my solution, but I used Array.prototype.map. After a bit of reading, I realized forEach is more appropriate. map returns the resulting array, which I don't need.
By editing a built-in prototype, you're assuming that by the time you need it, nobody else has done the same thing that you just did (but perhaps they figured "capitallize" would output 'nIfTy'). You're opening your code to error, or introducing error into someone else's code.
Yeah, I isually prefer being explicit. :)
This is very similar to my solution, but I used
Array.prototype.map
. After a bit of reading, I realizedforEach
is more appropriate.map
returns the resulting array, which I don't need.I like how expressive this code is. Most functions (including mine) leave the
rounds
implied in one expression.By editing a built-in prototype, you're assuming that by the time you need it, nobody else has done the same thing that you just did (but perhaps they figured "capitallize" would output 'nIfTy'). You're opening your code to error, or introducing error into someone else's code.