Home>

I'm making a notification app with React Native, but I'm having trouble comparing arrays.

I want to achieve

Assuming there was an array aaa
I want to output true if the array of aaa matches [1,2,3], false if it does not match.

Also, it is best if you can get true even if the array order is different like [2,1,3].

What I tried

I tried join () as below,
I got the error "string.aaa" is read-only.
I am a beginner, but I would appreciate it if you could teach me.

const string.aaa = aaa.join ();
if (string.aaa == "12") {
 console.log ('true')
 } else {
 console.log ('false')
 };
  • Answer # 1

    I reviewed the number of == and it worked.
    This has been resolved thanks to a better understanding of comparison operators.
    Thank you!