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

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