No. If either argument is greater than stringName.length, it is treated as if it were stringName.length.
EDIT: Just ignore that. I thought you were talking about JS not Java xD.
This comment is hidden because it contains spoiler information about the solution
The writer of the kata explicitly said not to use encode. You really should not have used it.
8 kyu kata are supposed to be for complete beginners. The replace method isn't taught to beginners.
I am not 100% sure because of the spacing, but I think that if you set "a" to "len(x)" then "a > len(x)" will always be false. This means that your code will be returning the length of the last word as the if statement will never be evaluated.
Loading collection data...
No.
If either argument is greater than stringName.length, it is treated as if it were stringName.length.
EDIT: Just ignore that. I thought you were talking about JS not Java xD.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The writer of the kata explicitly said not to use encode. You really should not have used it.
8 kyu kata are supposed to be for complete beginners. The replace method isn't taught to beginners.
This comment is hidden because it contains spoiler information about the solution
I am not 100% sure because of the spacing, but I think that if you set "a" to "len(x)" then "a > len(x)" will always be false. This means that your code will be returning the length of the last word as the if statement will never be evaluated.