Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thanks Balkoth, my mistake!
The testing framework seems to be buggy - go to Kata http://www.codewars.com/kata/5356ad2cbb858025d800111d/train/javascript
With my solution, I get the following error:
Expected: ["Bob"], instead got: ["Bob"]
...obviously, these are the same, so it should have passed! Below is my solution and test data (spoiler alert):
Solution:
function capMe(names) {
var capitalised = [], newName;
for (var i = 0; i<names.length; i++) {
newName = names[i].toLowerCase();
newName = newName.charAt(0).toUpperCase() + newName.slice(1);
capitalised.push(newName);
}
return capitalised;
}
TEST CASES:
var test = ['bob'];
Test.assertEquals(capMe(test), ['Bob']);
test = ['bob', 'james', 'CHRIS'];
Test.assertEquals(capMe(test), ['Bob', 'James', 'Chris']);