const text = [
'hello, world!!',
'fuck the world',
'fuck everything',
];
$('table').on('click', 'td', function() {
const $this = $(this);
const index = (+$this.data('index') + 1) % text.length;
$this.text(text[index]).data('index', index);
}).find('td').data('index', -1);