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.
nvm, I missed the literal value injections. I still hold that it's a bad test since JS doesn't care about types of numbers so saying it must be a float is confusing, but I must have messed up something else.
Well considering that JavaScript does not actually have floats, or more specifically everything is a float, (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures), there is an issue with the construction of the tests or at least the phrasing of them. Since testing if something is a float is literally testing if it's a number, this test must be doing something else. Sadly, I have not used this site in nearly 3 years so don't know what I actually coded back then, but I assue you there was good reason for my frustration.
As a related question - I seem to recall this site being very new at that time. Was "question" even an option then vs. issue?
Impressively useless response! So glad that you were able to mark the issue "resolved" by doing that. /facepalm
It errored out with "some is not a fuction". So unless there was a requirement I didn't see to implement something that had a function on it called "some" that the test could call... then the tests were broken.
Also, this was only the "user test" setion, the on-submit tests work fine (and, I notice, don't have the crazy setup).
(Edit to note that this is for the Javascript version. It's possible the tests were ported badly from a functional language or something.)
Something was really messed up with the provided "user tests". I couldn't make heads or tales of them, so just deleted them and used the submit ones.
1 significant problem, as illustrated by the top solution - your tests only have false cases that are negative or even. You need far more tests to prove a valid function. Consider a random test generator paired with a known-to-be-accurate solution, combined with several non-even false primes.
Very unhelpful response. What is missing that you needed?
I am exceptionally frustrated with this. My solution works great, covers the null case, has O(1) so far as I can tell, etc. But no matter what I do, I can't make it return something the test will accept as a float. parseFloat() returns 'number'. x * 1.0 returns 'number'. Hell, even 123.456 returns 'number'. So far as I know, JS treats all numbers as floats, so WTF is the test looking for? Am I supposed to return the string "float" or something??
This comment is hidden because it contains spoiler information about the solution
This should be given as a solution, not posted in the discourse section unless you are calling out something specific (if so, you provided no text to do so).
This is what caught me as well.
Nice kata in general, but you should add a test case for something like 79797979797979797979797979797. Many of the solutions "cheat" to pass the tests by simply running through the "797" replace twice. As mentioned below, also consider the case of 79999997.