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.
Returning inconsistent data types is not a best practice.
Stringifying results is not a best practice. Use appropriate data types.
( I'm not sure if the kata is even worth improving at all though. )
Almost duplicate:
https://www.codewars.com/kata/rotate-array
https://www.codewars.com/kata/rotate-array-js
Edge cases with
k == 0
andk == arr.length - 1
should be tested.And
k == arr.length
too that probably should perform the rotation instead...That's not a rotation.
A string is expected instead.