I hope you can help me in this mind blowing problem I have:
Well, I have 2 different arrays (cam and existentes). The [2] value of existentes is the same string than the 1 value of cam. But when I try to compare existentes [2] == cam [1]
it returns a False.
You are comparing two arrays : [Remarketing] == [Remarketing]
while you should be comparing two strings Remarketing == Remarketing
:
existentes[2][0]==cam[1][0]
const ar1 = ["Remarketing"]; const ar2 = ["Remarketing"]; console.log(ar1==ar2); // returns false console.log(ar1[0]==ar2[0]); // returns true
In case you had arrays with multiple elements you wanted to compare, then you can read this post on how to compare two arrays in JavaScript
:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.