I'm trying to change function name by adding an increment number to it's end each time it gets executed, to achieve a new function name each time the code is executed.
<button id="Btn">alert text</button>
function text1(){
alert("This is text1");
}
function text2(){
alert("This is text2");
}
function text3(){
alert("This is text3");
}
var Btn = document.getElementById("Btn");
var i = 1;
Btn.addEventListener("click", function alertText(){
i++;
//bellow line in the first time should be text2()
text+i();
}