Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!