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.
The kata's premise is flawed: JS objects do not exactly follow key insertion order, but is defined as
Only
Map
s andSet
s retain insertion order regardless of key/value types.Needs edge case with 0 input arguments: at least 1 solution fails in this case.
Test fixture is vulnerable to input modification: https://www.codewars.com/kata/reviews/57056369006458d7e100002f/groups/6451be4d582ac90001eb585b
This is an issue.
(By the way, your proposed
compareObjects
is bug-ridden.)Your code didn't close properly.
Unpublishing as a duplicate.
Random tests feature uppercase and lowercase characters but the kata description doesn't warn about this.
Expected: {"name":"Joe Doe","address":"123 Fake Street","year":2010,"married":true,"allergies":"nuts"},
instead got: {"year":2010,"name":"Joe Doe","address":"123 Fake Street","married":true,"allergies":"nuts"}
You're comparing objects with JSON.stringify, which means order will affect it. You should compare it by iterating through the object keys and seeing if they're both the same values instead, like this
EDIT: oh, just reread the description. "The fields should be in order of their first chronological appearance in a log."
This still seems silly to me though, as JS objects aren't meant to be ordered anyway AFAIK. If you want it to be ordered, maybe you could make a 2d array instead, like this:
Changed label to suggestion.
Fixture broken?
Ah, my mistake! When I searched I forgot to include beta kata, so it only showed 11 Palindrome related kata, and all of them were significantly different and more difficult than just testing whether something is a palindrome.
Duplicate of a lot of katas.
This comment is hidden because it contains spoiler information about the solution