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.
the console log is just for everyone to see the output without having to run it themselves.. just convenience.. it doesn't change much
I think what you did was to add a console.log call inside the callback but that function is NOT toCamelCase and that is not what this solution is returning as its result. that you printed six lines for three test cases should have tipped you off!
These are the tests i ran :
toCamelCase("the-stealth-warrior");
toCamelCase("The_Stealth_Warrior");
toCamelCase("The_Stealth-Warrior");
And this is the output:
S
W
S
W
S
W
This just returns the cap of the index after the '_' or "-"
This comment is hidden because it contains spoiler information about the solution
It doesn't work for string that has more than 1 dash/underscore group together.
i.e. toCamelCase('the__stealth-warrior')
Smart! But it only converts the first character in each word to uppercase. Shouldn't it also convert the rest of the characters in each word to lowercase?
Nah this dojo level is insanse.
space delimeter missing
It will not work in cases like
toCamelCase("-the-stealth-warrior") === TheStealthWarrior // incorrect
I think my solution is more understandable, Just kidding
I like it but your solution would not work for cases like: oguNbanjo--_temiloluwa
I agree with you. I think that it is just a good practice for independent function.
The description does not specify what the expected output for a missing input is so you don't have to account for this case. If it would still be tested then this would be worth a kata issue but
undefined
/null
inputs just don't make sense for this kata.I think you also need to add the check for undefined value at the start of function.
if (str === undefined){
return '';
}
Loading more items...