Buongiorno, ho creato uno script che dovrebbe cambiare automaticamente il contenuto di <h1>, leggendo dei valori da un array.. il problema e` che le variabili vengono restituire come undefinied (provando con alert al posto di text)

$( document ).ready(function(){

function h1changer(i) {

var h1 = new Array("HELLO", "HOWDY", "AIGHT", "BRUV");
var x = h1.length;

for (var i = 0; i < x; i++) {


setTimeout(function() {
$('h1').text(h1[i]);
}, 2000);

}

}

h1changer();

});


qualche idea ?