Typing effect p5js

Hello, Sorry to bother you again, I am in a programming class and for our homework trying to animate and make a typography effect that repeats itself but I am getting a bit confused, any help? Thank you!

var canvasWH = 400;
var palabra= "Hola!"; 
var pos = 0; 

function setup() {
  createCanvas(canvasWH, canvasWH);
  frameRate(10); 
}

function draw() {  
  textFont('Typewriter');
  textSize(12);
  text(palabra.substring(pos, pos + 1), pos++, canvasWH/2, canvasWH, 100);
  pos = +++

 if (pos > width) {
 pos = 0;
 }
}```

This answer was not sufficient? https://stackoverflow.com/questions/72221785/typewriter-effect-p5-js