Having difficulties using stdin with Node.js

Hey everyone, I’m trying to solve one of the data structure problems on HackerRank. In this problem we’re basically given an array of numbers and asked to rotate the array a given number of rotations to the left.

I’ve produced a solution that works in Repl.it.

function leftRotation (arr, rotations) {
  let splicedValue;
  for (let i = 0; i < rotations; i+=1) {
splicedValue = arr.splice(0, 1).join("");
arr.push(parseInt(splicedValue))
  }
  return arr
}

leftRotation([5, 1, 2, 3, 4], 3)

Unfortunately, I can’t pass the user tests on HackerRank because I’m not sure how I should convert my solution to using stdout, and especially stdin (to receive the varying inputs I need to pass the various user tests on HackerRank). Do you have any ideas on what argument I should be passing to my function when I call it?

I’ve already tried stdin, inputStdin, inputString, etc, and I just can’t figure out what else I could try. I really appreciate any help you may be able to offer.

function leftRotation(arr, rotations) {
    let splicedValue;
    for (let i = 0; i < rotations; i += 1) {
        splicedValue = arr.splice(0, 1).join("");
        arr.push(parseInt(splicedValue))
    }
    process.stdout.write(`${arr}`)
}

leftRotation(arr, rotations) //  <-- I need help here.