Greets, so I've been trying to make my vine-generator to generate a random vine each time you run it. I am trying to make it so that the last 3 given vines will never repeat themselves.
Note that I only want to check for the last 3 given vines to avoid.
var vines = [
  ['https://www.youtube.com/watch?v=21yI4dtAyJQ', 'Gotta love dogs'],
  ['https://www.youtube.com/watch?v=MB1Ud95U8FE', 'The struggle of measuring something without measuring tape'],
  ['https://www.youtube.com/watch?v=b6l63-AdU6Y', 'When the cars full but u still tryna roll with the squad'],
  ['https://www.youtube.com/watch?v=19KOD8-mGm4', 'When the pool water is too cold..'],
  ['https://www.youtube.com/watch?v=05Bf5vs8j9Q', 'Can I please get a waffle?'],
  ['https://www.youtube.com/watch?v=2IekMo_DQmw', 'Cheese of truth']
];
var random = Math.floor((Math.random() * vines.length) + 0);
var prev = [];
function Scramble(number, last) { 
    if(last.includes(number)) {
        Scramble(random, prev);  // If the previous number matches current rerun function for a new number.
    }
    if(last.length === 3) {
        last.pop(); // Removes the 3rd vine to make room for a new one.
    }
        last.unshift(number); // Register the last given number.
        console.log(`[${number+1}] ${vines[number][1]}\n${vines[number][0]}`)
}
Scramble(random, prev);
 
     
    