HackerRank - Left Rotation in JavaScript
Review


Since you are building the array yourself, as opposed to you get a source array from a consumer of your method, I don't think you should create a new array, but rather just adapt the source array. This way, you could avoid slice and concat altogether.
The number of rotations is an integer. However, reading the description behind the link tells use it's clamped between 1 &lt;= rotations &lt;= nd. There is a slight optimization here. If rotations = nd you don't have to do anything, since a rotation is circular. An elegant way to check this is to normalize rotations as rotations = rotations % nd; assuming you have already checked rotations againsts the clamped range. if rotations = 0, don't rotate.
There's another optimization if nd &lt; 2, then any rotation is the source itself.