Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
JavaScript change function name by adding an increment number to it's end

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();

}

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda