Beta
Object to Array
186AzariasB
Loading description...
Arrays
Algorithms
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.
JS: Node v14 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this
It's an implicit guess as to what kind of keys would constitute as a number.
Ehm, actually, no, that's not how it works.
This is not tested.
Also, the random tests somehow (all, both object and array!) accept
undefined
as a correct answer, and are vulnerable to input modification.About the
You must not change the value given in input
this is impicitly tested. If the user modifies the array, the test will fail, same for the object.The random test cases where accepting anythin since I was testing the user's function against itself ! Thanks for reporting, it's now fixed.
I can see how that can happen .. :smile: good job on the quick fix!
It may be worth noting that since object keys are strings, a type conversion is needed to return an array with the Number value of a given key.
Basically, the input object
{'1':5}
forobjectToArray
is expected to return an array[1,1,1,1,1]
, and not['1','1','1','1','1']
.Done :)
Error in the instructions:
It should read:
Thanks, fixed
(marking as resolved)
An error in the test cases prevents a valid solution:
It should read:
Thanks, fixed