0

I need an small help I've a scenario where I need to compare array of boolean and return true or false

const val = [true] != [true]
console.log(val)
When we compare it returns true which isn't correct I need it should return false. Any alternative to toString() method
Mitul Panchal
  • 143
  • 2
  • 13
  • You can't compare objects like this in JavaScript. You can just compare array of booleans as you compare any array, just search "compare arrays in JavaScript" on stackoverflow. If you array always contains only one boolean, then you can just compare the first value of both: `a[0] === b[0]` – Christian Vincenzo Traina Mar 31 '23 at 13:03

0 Answers0