0

I've tried everything. Hours later... I found out the basic == statement isn't working

Here's the code

console.log('The from1 section', from1.section);
console.log('The sender1 section', sender1.section);
if (from1.section == sender1.section) {
    console.log('It worked');
} else {
    console.log('They are not the same');
}

Here's the output

2015-02-01T02:19:46.371814+00:00 app[web.2]: They are not the same
2015-02-01T02:19:46.371652+00:00 app[web.2]: The from1 section ["54baf92d2b54840900dcb971"]
2015-02-01T02:19:46.371761+00:00 app[web.2]: The sender1 section ["54baf92d2b54840900dcb971"]
UX Guy
  • 257
  • 2
  • 13
  • 5
    Two different array objects will **never** be `==` to each other. Object equality comparison is a comparison to see whether both expressions result in references to the same identical object. Two objects that look the same are still two distinct objects. – Pointy Feb 01 '15 at 02:24
  • @Pointy You should post that as an answer. – Brad Feb 01 '15 at 02:25
  • 2
    @Brad I was searching for a duplicate; there must be dozens but I haven't found a good one yet. – Pointy Feb 01 '15 at 02:26
  • http://stackoverflow.com/questions/3115982/how-to-check-javascript-array-equals – epascarello Feb 01 '15 at 02:26

0 Answers0