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

106
Vistas
Javascript compare equality between arrays?

I'm trying to do the isPalindrome question on LeetCode. I know how to solve this question, but I'm just confused why the following code doesn't work so that I can better understand the nuances of JS. I would like to know why JS seems to think that even when reverse and forward.split("") are exactly the same, it should still return false. The issue lies in the if (reverse == forward.split("")) line. I thought this issue is because JS can't compare arrays, but a quick online search seems to suggest JS can.

var isPalindrome = function(s) {

let forward = s.replace(/[^0-9a-z]/gi, '').toLowerCase()

let reverse = forward.split("").reverse()
if (reverse == forward.split("")) {
    return true
}
return false
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