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.
This is how I did it but I used a ternary operator
Oh I never saw that one, thanks you for reply !
Hi! This is a shorter way of accessing the
.charAt()
method on a string. Take a look at the docs here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#character_accessHi! Beginner here, I thought [] was for the array only. Why, can we use [] for the string "name" here? Sorry for my bad english.
I mean, as far as solving the solution without using any built-in methods goes, this works well.
Oh! Thanx, I think i se now
They add space for all of each word, except word in last index of array (words.length-1)
I can't get, what's doing those lines of code:
if(i!=words.length-1) {
smashed += ' ';
}
Could you explain it to me pls ?
Anyway you get an unnecessary space at the start of smashed string, don't you ?
This is more or less how I did mine. The only difference is that I used string interpolation instead.
This comment is hidden because it contains spoiler information about the solution
In general a good practice is to avoid unnecessary code, but sometimes it's better to write more for readability.
Isn't also a best practice not to have multiple return statements when not necessary?
It's not a good practice to put else statement after return.
Interesting approach!
Loading more items...