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.
I think it's more like 6kyu
(JS) Push and unshift methods do not work when toLowerCase used in any part of code. In browser console code work fine
random tip, I tend to read these like a sentence.. so
0 <= x <= 4
would read as:0
is "less than or equal to"x
andx
is "less than or equal to"4
.Wouldn't that render this kata trivial and not deserving a 5kyu rating?
the values for the x should be between those parameters
I already told you exactly which sample test your code is failing, use Pythontutor or other IDE to debug your code step by step and see what's wrong with it. Don't chain methods until you properly understand what they return in each of them, pull them apart and log what they return, you'll find out what's wrong with your code easier that way.
Undefined is valid only when it's "" in test - empty string has no length. So I add check on string.length with break to quit code execution: switch (str.length) { case 0: return false break} ABOVE toUpperCase method line, so it had to be irrelevant wether toUpperCase were used in code in lower lines or not.
Why have testing keep throw an toUpperCase error when I quit code execution before toUpperCase method has been applied?
The tests have no problem with either method, it's your code that's trying to use them wrong, read the error message:
undefined
doesn't havetoUpperCase
method, that's a string method. Debug your code, add someconsole.log()
s to help you with that. Read this: https://docs.codewars.com/training/troubleshootingCurrently, your code fails this sample test:
I keep rewrite my code over and over again. I do not use touppercase, (though, why?), I keep have right answers in my browser console, and I keep have errors when trying to test it. Different errors. First version apparently didn't like touppercase using, ok, I changed it. Second version didn't like an replace method (not sure but still, it was adviced in discussion), I changed it too. Third version didn't like an one word case test - expected false to equal '#CodeWars'. But I do have '#CodeWars' as a result in browser console! I also do not check string.length too early, and still, errors.
The test for this cata is written POORLY and BUGGY! Why does it reject touppercase method and keep throw an error? It also reject fromCharCode(charCodeAt) method and also keep throw an error.
What. Is. Wrong. With. This. Cata???
If your test code do have problems with certain methods, then may be you'd mention it in cata conditions not to use this and that?
Ok, but why? Isn't it an cata testing problem if it keep throw error when you solve a task with method that is different from what author expected you'l be using?
Wow, new method, thanks!
Did you read the description? "have to" means it is required.
The title also says Filter in it and there is a link to MDN docs.
Author have to specify that you required to solve this cata with filter method, not mention it. He have to point out that other solve variations wouldn't pass tests.
This comment is hidden because it contains spoiler information about the solution
If you try to solve it with reg exp, you have to keep in mind .match method return either non empty array of matches or null. So you need to not just match (think for other methods for null check)
Loading more items...