I have an array of 15 random numbers, I need to pick 5 numbers from this and send with a postman POST request, but each time I send the number I must include the last number picked ( I.e 1 then 1,2 then 1,2,3, etc)
I know I need to utilise the get next request function in postman to move on when all 5 numbers have been picked.
var myArray = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; //Setting the array.
var newArray = myArray.sort(() => Math.random() - 0.5); //randomise the array.
let contPicks = myArray.slice(0, 5); //pick first 5 values from the shuffled array
let pickOne = contPicks.slice(0,1);
let pickTwo = contPicks.slice(0,2);
let pickThree = contPicks.slice(0,3);
let pickFour = contPicks.slice(0,4);
let pickFive = contPicks.slice(0,5);
It’s probably not the most efficient way of doing this, as I said, I’m a beginner and while I understand the syntax, applying it is another thing entirely! lol