Questions tagged [triple-equals]

The triple-equal operator (===) refers to objects that are both equal and of the same type.

The triple-equal operator (===) refers to objects that are both equal and of the same type.

The languages JavaScript and PHP uses this syntax, with the == operator able to return true if two values are equal, even if they have different types (for example, "4 == "4"" is true), and the "===" operator returning true only if two values are equal and have equivalent types as well (such that "4 === "4"" is false but "4 === 4" is true). [1]

18 questions
0
votes
1 answer

Changing == to === in if(window.location == 'x') causes the block not to execute

I'm checking over my code for uses of == instead of ===, but changing this line: if(window.location == 'app:/test.html') To this: if(window.location === 'app:/test.html') Results in the block no longer being executed. What is the correct approach?
Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
-1
votes
3 answers

'hello' == (anything that will return true other than 'hello') in JavaScript?

I understand that == in JavaScript is comparison with type coercion. And I know that the following statements are true: '' == false; ' ' == false; '0' == false; '\n' == false; However, I can't get a comparison with 'hello' on the left side to be…
at.
  • 50,922
  • 104
  • 292
  • 461
-2
votes
1 answer

Triple equal in JavaScript compare the value of type first?

Triple equal measure the value as well as type. But I want to know the order like it first compares the value and returns on false or vice versa.
Muhammad Arqam
  • 119
  • 1
  • 5
  • 13
1
2