This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 218091 - expected '===' and instead saw '=='
Summary: expected '===' and instead saw '=='
Status: RESOLVED INCOMPLETE
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-11 04:18 UTC by alaksundar
Modified: 2013-03-05 09:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alaksundar 2012-09-11 04:18:19 UTC
if (j == 'n')
Comment 1 Petr Pisl 2012-09-11 07:39:01 UTC
I'm sorry, I don't understand what is the problem. Please specify more.
Comment 2 alex_torfan 2013-03-04 09:02:51 UTC
Why requires '===' instead of '==' ???
Comment 3 Petr Pisl 2013-03-05 09:23:32 UTC
Because it's JavaScript good practice. Quotation from JsLint documentation:

The == and != operators do type coercion before comparing. This is bad because it causes ' \t\r\n' == 0 to be true. This can mask type errors. JSLint cannot reliably determine if == is being used correctly, so it is best to not use == and != at all and to always use the more reliable === and !== operators instead.