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

111
Views
¿Javascript compara la igualdad entre matrices?

Estoy tratando de hacer la pregunta de isPalindrome en LeetCode. Sé cómo resolver esta pregunta, pero estoy confundido por qué el siguiente código no funciona para poder comprender mejor los matices de JS. Me gustaría saber por qué JS parece pensar que incluso cuando reverse y forward.split ("") son exactamente iguales, aún debería devolver false. El problema radica en la línea if (reverse == forward.split("")) . Pensé que este problema se debe a que JS no puede comparar matrices, pero una búsqueda rápida en línea parece sugerir que JS sí puede.

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