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

151
Vistas
Are pure function calls optimized in JavaScript?

Today I was wondering something and couldn't find the answer anywhere: let's say I have a pure function and I'm calling it 2 times in a row with the same parameters, will there be any compiler optimization (or something like that) that will recognize that the function is pure and will cache the result in some ways?

For example, in that code:

const myString = "a,b,c";
console.log(myString.split(","));
console.log(myString.split(","));

Is there anything that will cache the result of the first myString.split(",") and re-use it the second time? I'm assuming that not, because it would require to determine that the function is pure, which could be cumbersome if that function lazy loads something for example, or if the function calls other functions etc...

Thanks!

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