Modify this code

let i = 0, j = 1;
let timeBetweenLetters = 150, timeBetweenSentences = 300;
let interval;
const texts = [
"Free Goods",
"Best Service",
"Discounted Price"
];
function runSentences(){
 interval = setInterval(showText,timeBetweenLetters)
}
    function showText() {
	const s = texts[i];
	const toShow =  s.substring(0, j);
	if(toShow.length === s.length){
		j = 1; 
		i = (i + 1) % texts.length;
		clearInterval(interval);
		setTimeout(runSentences, timeBetweenSentences)
	} else {
		j++;
	}
	$w('#text').text = toShow;
    } 
    $w.onReady(() => runSentences());