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
Is behavior of Javascript toFixed() consistent between browsers? (leading zero and rounding)

I tried document.write((2/3).toFixed(3)); in JSFiddle, and it came out as 0.667. I am running Firefox on Windows, if that matters.

Will (2/3).toFixed(3) always give me "0.667", and never ".667" or "0.666" or ".666" or anything else? Are different browsers allowed to behave differently? Or may I rely on the presence of the leading zero, and rounding to nearest?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The behavior of toFixed is fully specified in the JavaScript specification and locale is not considered as part of those steps. As such, its output is consistent between conforming implementations of JavaScript engines.

about 4 years ago · Juan Pablo Isaza Report
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!