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.
wow i just saw that, of course message from test -> "Function must return a string value: expected NaN to equal '5'" refers to my handling of the empty strings. There was a conflict in my head where statement says clear integers from [0-9], but test requires a not NaN return when an empty string passes. Thank you!
wow i just saw that, of course message from test -> "Function must return a string value: expected NaN to equal '5'" refers to my handling of the empty strings there. It just was a conflict in my head where statement says clear integers from [0-9], but test requires a not NaN return when an empty string passes. Thank you!
Hi @akimochev - it's a bit hard to read your code due to all the conditions at the top, but it seems that you are checking for the case where both input strings are empty
(n1 == '' and n2 == '')
<- here you are using and but it should be or I thinkAlso, rather than just
return '0'
when one of the inputs is empty string, the kata is asking you to treat the empty string as = 0, so you shouldreturn value of the other, nonempty string
instead ofreturn '0'
.Basically it's not handling the case where only 1 of the 2 strings is empty. For example there is a test:
n1 = "9999", n2 = ""
<- correct answer is "9999"and looking at your checks at the start of the code, I don't believe this is handled correctly.
This comment is hidden because it contains spoiler information about the solution
Some tests in JavaScript pass in empty strings, and your solution fails on these. Empty strings should be treated as
"0"
.Yes, this input sucks. But still, even though you say you check agains it, it's not done correctly.
Javascript, also tried my solution in https://www.codewars.com/kata/525f4206b73515bffb000b21 as they say its duplicated and it works there
In what language?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution