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.
2 years later its like 2 chicken wings 8|
love this, stealing this ;D
lol...so many emotions right now
It's fine, we all experience similar problems when starting out here. I know I struggled myself seeing how empty string could be split into 1-length array, not
[]
, but you'll learn these things with practice :P (oh, and lots of debugging with console logs)Thank you for helping me!! Sorry I didnt take your intial advice and think on it before responding and making you do more work. I really do appreciate it and I was trying to follow the posting cheat sheet but hence I am dumb and failed at that as well :( Thanks again though as this helped me with not just the challenge but I understand better how Codewars tests and I will work on my forum posting ettique.
I am an idiot! The first advice you gave me I just needed to stop and think about it for a second...So I was passing the first test but then it was going into the other test(because umm ea i am dumb lol) and then getting hung up on spaces just like you said.
By the way, when posting some code snippet you should follow this syntax: https://docs.codewars.com/references/markdown/#code-block
I just checked the sample tests, so I know where it crashes.
"".split(' ')
==['']
(I think), so your loop will never terminate.What you need to do is to use console.log inside the loops, and probably at the start to see which input fails. An example in python is shown here: https://docs.codewars.com/training/troubleshooting/#print-input
but its crashing when I just try and rejoin my answer already populated in my array. I see what everyone is saying about extra white space but run my code in replit and it returns just fine but then try in codewars and crashes. its odd.
yes i noticed this after the fact :P but hey since you are here and I have someones attention any clue why i am timing out?? check the lastest "Question" as i think i posted my question correctly this time.
Just use some console logs and you'll see the problem quickly. Your code fails for empty string, which is even shown to you in sample tests.
Well, it says it's a question to me :P
This comment is hidden because it contains spoiler information about the solution
You cannot change a tag once the message is posted ;)
sorry my first post but I changed it over to questions you just were way to fast for me!! :)
Loading more items...