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

161
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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