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.
midudev talked that switch isn´t not better than the Objects.
If the case evaluates true, then it executes the statement after the colon and before the break. So if the first case is not true, it checks the following cases.
How will it convert all the strings letters to its complimentary letter if it [break] at the first letter it finds to replace? If im not mistaken, doesn't the [break] keyword exit the iteration out of the switch statment and if so how will we find the complimentary letters for the other letters of the input string?
Because some people (icluding me) didn't knew about .replace.
It's not bad practice. It's just different approach taking into consideration the performance of the solution.
try to figure it out why paj :D
This code has had the fastest run-time of all the solutions I've tested so far. Good Job.
why use switch/if conditions if Javascript has already functions like .replace(), .split() .map() .join() etc, which can reduce the number of lines you code? Indeed a bad practise.