标签云

微信群

扫码加入我们

WeChat QR Code

Possible Duplicate:Javascript === vs == : Does it matter which “equal” operator I use?What are the differences between === and ==, !== and ==... when should you use one and when should you use the other?


This is a dupe of about 1000 questions

2019年05月22日04分32秒

Can you post a link to those other questions? I always make sure I look first, obviously the titles weren't clear enough to be found easily. Maybe having this question in as well will help point people in the right direction in case they haven't searched for the exact thing.

2019年05月22日04分32秒

My thoughts exactly. Here's one: stackoverflow.com/questions/359494/javascript-vs

2019年05月22日04分32秒

I think the problem is you can't search for ===.

2019年05月22日04分32秒

I updated the title of stackoverflow.com/questions/359494 so hopefully it will be a little easier to find. You can't search === but you can search "equal."

2019年05月22日04分32秒

nice and definitive

2019年05月22日04分32秒

"1" == true.. what? I thought I knew these rules thanks for highlighting

2019年05月22日04分32秒

KissKoppány if you're confused, it's because 1 and 0 are boolean operators. == does type conversion, so '1' == 1 == true, '0' == 0 == false. === does NOT do type conversion. Generally it's better to go with === unless you expect your vars to typechange frequently which is bizarre (to me at least)

2019年05月22日04分32秒