0

I am trying to test if(tk0 == address.GGG) this fails but should be true. if I do this it works if(tk0 == "1234567890") then it works. I can read address.GGG before the if in console.log and after the if in console.log.. they both show typeof string when tested. I am at a loss.. I have also tried to set GGG with let and var no dice.

const addresses = {
  GGG: '1234567890',
  PPP: '4958938485'
}
//I know that tk0 is going to = GGG for this example.
factory.on('something', async (tk0, tk1, pa) => {

  let tkIn , tkOut ;
  
  if(tk0 == addresses.GGG) {
    tkIn = tk0;

  }

    console.log(`tkIn: ${tkIn}`);
  
});

 
LiveWire
  • 101
  • 1
  • 1
    Do you see any exclamation point when adding this before the if? `console.log( addresses.GGG + '\n' + addresses.GGG.split('').map((c, i) => c === tk0[i] ? '-' : '!').join('') + '\n' + tk0 );` – blex May 15 '21 at 00:33
  • Not directly related, but please see [Which equals operator (== vs ===) should be used in JavaScript comparisons?](https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons) – SuperStormer May 15 '21 at 00:34
  • @blex you ROCK! Thank you! – LiveWire May 15 '21 at 00:51

0 Answers0