В настоящее время я использую
function showGrowl(lastNumber) {
var num = lastNumber;
//keep generating a random number untill it is not the same as the lastNumber used
while((num = Math.ceil(Math.random() * 3)) == lastNumber);
//create a clone of the chosen notification
var clone = $('.notification.n' + num).clone();
//show the clone
clone.appendTo('#contain').show('fast', function() {
//10 seconds after showing, hide the notification
setTimeout(function() {
clone.hide('fast', function() {
//once it is hidden remove it
clone.remove();
//then two seconds later show a new notification
setTimeout(function() {
showGrowl(lastNumber)
}, 2000);
})
}, 10000);
});
}
Однако lastNumber всегда неопределен при повторном вызове функции, что мне нужно сделать, чтобы определить lastNumber?