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.
Even better would be to put the string in an array and print that array:
That way you are shown things like
\r\n\t
without ambiguityThanks Chrono, that made the console.log work and showed me why it's failing.
Apparently it's failing on an empty string, which I thought since it wasn't testing for null, it wouldn't matter.
I just learned something! An empty string '' !== null
Welp. Okay. I wasn't going to submit with your code because... well it's your code, and I haven't solved it yet >.>
I ran it anyhow. I see it now.
How do I phrase this .. Yes, this is confusing test output. Though, they're correctly judging your result. The output is off because ... because codewars uses imperfect encoding of data between the tests, the servers and our browsers and because of that there can be ambiguities or mixups. You are logging, it isn't shown.
Replace
console.log(string)
withconsole.log("Input value: '" + string + "'")
There is nothing wrong with the tests.
My code passes the sample tests, it's when I "attempt" that I get the error.
Apologies for not putting my code up front, but it's up there now (under a spoiler tag). It's the one out of however many dozens or hundreds of test that is failing upon "Attempt". And it always fails after a string with exactly five spaces in it (the next test, which I didn't copy/paste has more than five spaces, and it passes), and it since the console.log does not run, I'm assuming the test is flawed somehow.
BTW. Next time you ask about something odd, make sure that you are up-fronting enough information to reproduce what you're seeing. Otherwise you are the host of a guessing game, and you probably aren't getting any answers that you want as a result of not having provided enough information to produce those answers.
For example, you showed your solution code... which is good, but not sufficient. Pressing reset and entering your code, followed by running the sample tests does not produce the output you're describing. So effectively it isn't happening and you can't really ask about something that isn't happening.
Of course, we could trust you on what you're saying, but that doesn't ... really work at all. First of all, why would we? You might know yourself to be trustworthy, nobody else does. And then there's going to be information lost in communication, and furthermore you're probably not making the required observations or you'd have figured it all out. But when you show how to reproduce it, you get rid of all those very difficult problems.
The original sample tests have four assertions, you show five. That makes the fifth assertion likely to be something you added. And presumably the reason why there is no log is because nothing was logged.
This comment is hidden because it contains spoiler information about the solution
Those are separate tests. Note that you get one verdict per assertion.
Here's a you look at how every other test prints, to give a better view of the anamoly..
Log
Mazinkaiser
Test Passed: Value == true
Log
hello world_
Test Passed: Value == false
Log
PassW0rd
Test Passed: Value == true
Log
Test Passed: Value == false
Expected: false, instead got: true
See? It's saying, "Test passed", then immediately "Expected false"... My code shouldn't be able to pass and then fail?
Again, the blank log is five whitespaces. Any other number of whitespaces passes the test.
This comment is hidden because it contains spoiler information about the solution
Your code is failing the next test.
This comment is hidden because it contains spoiler information about the solution