7 kyu
Sign in/Sign out but sign it
967 of 970ZozoFouchtra
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
i wanted to make this kata, but it was a dupe of this :p
https://www.codewars.com/kata/reviews/543da4cd81b5fd238500001c/groups/5ec33f7134543e00014bd8bd (I could come up with a bunch more.)
No random tests.
As of now, random tests have random inputs, but not random expected values. That means they're predictable, can be hardcoded, and are insufficient as random tests.
That said, hardcoding this kata hardly seems worth it; it's less work to just solve it.
CoffeeScript translation kumited! Please Accept :D
Just formal issue : Add a message in comment. Great Kata.
@brice: In which comment do you want to add a (which?) message ?
This comment has been hidden.
Done.
This comment has been hidden.
Ok, modified too.
Looks good, thanks!
This comment has been hidden.
This comment has been hidden.
Believe it or not, there is a relatively simple explanation, and it isn't that Javascript treats them differently. It's because of
Array.prototype.toString
, and how that string is subsequently coerced to a number.When necessary to perform comparisons between an object and a primitive, the object is coerced to a string using its
toString
method:[1,2] > 0
becomes"1,2" > 0
Now, if one side of a comparison is a number (or boolean), the other side is coerced to a number as well; otherwise, they're compared as strings. So:
"1,2" > 0
becomesNaN > 0
"1,2" > "0"
isn't changed, because neither side is a numberIf you change
Array.prototype.toString
, then an array such as[1,2]
can become any string you want it to become. E.g.Simple and straightforward. Good job.