Displaying from an array

Hi, thank you for the response but I really wanna see it done using arrays if that’s possible… And I’m sorry if I didn’t mention this in the question but I’m not really looking at it as a timer but rather as a function that takes in a value, counts it down to 0 and that’s all!

I have managed to work around and get it to just go through the array and display the last entry of the array, so now I’ve to find a way to make the loop not run instantaneously?

var range = [];
var indexCounter;

function setup() {
  createCanvas(400, 400);
  textAlign(CENTER, CENTER);
  textSize(24);
  sequence(10);
}

function draw() {
 
}

function sequence(number) {
  for (i = number; i >= 0; i--) {  
       range.push(i);
  }
  
  for (j = range.length; j >= 0; j--) {
        indexCounter = range[j];
    }
  text(range[indexCounter], width / 2, height / 2);
}