[OpenLayers-Dev] JS Lint complaining about == instead of ===

Andreas Hocevar ahocevar at opengeo.org
Wed Mar 14 18:21:20 EDT 2012


Hi,

we usually use something == null to check if it is undefined or null.
This is perfectly sane, and has been discussed in the context of other
JS frameworks as well.

Andreas.

On Wed, Mar 14, 2012 at 10:49 PM, Tim-Hinnerk Heuer <th.heuer at gmail.com> wrote:
> Hi,
>
> Just wondering: While looking through the code of OpenLayers and saving the
> scripts (when my editor automatically runs jslint to check the code for
> sanity), I get a lot of warning where you have e.g.:
>
> if (a == null) { // WARNING HERE
>     // do something
> }
> and jslint tells me, it should be
> if (a === null) { // NO WARNING HERE
>     // do something
> }
> (which is when the error/warning goes away). I was wondering if we should
> put triple === in those places instead. I know it would be a daunting task
> to do so but wouldn't it be better to get more consistent results? Because a
> == null is true when a =
>
> To be fair it's just annoying getting these warnings when coding. Maybe I
> can turn that part of reporting off somehow, because it seems almost
> over-sensitive.
>
> Tim
>
> ++Tim Hinnerk Heuer++
>
> Twitter: @timhheuer
> Blog: http://www.thheuer.com
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Dev mailing list