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

180
Vistas
How I am getting Output = 1 for console.log('6'/'6') in Javascript. It should not be able to devide two strings

Check the code Image

How I am getting Output = 1 for console.log('6'/'6') in Javascript. It should not be able to devide two strings

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When a mathematical operator that only makes sense on numbers is applied to two expressions, both expressions are coerced to numbers first..

4. Let lnum be ? ToNumeric(lval).
5. Let rnum be ? ToNumeric(rval).
7. 7. Let operation be the abstract operation associated with opText and Type(lnum) in the following table:
...

which then calls Number::divide with lnum and rnum.

The only exception is +, which will only add if both sides are numbers - otherwise, it will coerce both sides to strings and then concatenate.

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