Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
94
rated 0 times [  98] [ 4]  / answers: 1 / hits: 15594  / 13 Years ago, wed, january 18, 2012, 12:00:00

Someone sent me this email:



Why do both of these alert to false?



alert('a‌' == 'a');
alert('a‌' === 'a');


Here's a demo



JSFiddle DEMO


More From » javascript

 Answers
38

Is this a trick? Did you generate those a's with some special unicode magic? I deleted the a's and re-typed them, and now both alerts show true, as they should



Updated Fiddle


[#87936] Tuesday, January 17, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tobyl

Total Points: 598
Total Questions: 110
Total Answers: 114

Location: Vietnam
Member since Sat, Feb 12, 2022
2 Years ago
tobyl questions
Tue, Aug 10, 21, 00:00, 3 Years ago
Wed, Jan 13, 21, 00:00, 3 Years ago
Tue, Dec 1, 20, 00:00, 4 Years ago
;