google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.01k stars 13.28k forks source link

Correction: jsguide.html - Changed null to undefined #802

Closed KumarSidharth closed 3 weeks ago

KumarSidharth commented 5 months ago

This change is "Not important".

Please don't review this leaving your work behind.

Change description

Keys not defined in an Object are undefined.

const o = {width: 42};
o.maxWidth === null // false
o.maxWidth === undefined // true
image
google-cla[bot] commented 5 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

vapier commented 3 weeks ago

the example is using !=, not !==, so there is coercion involved, so I think this is written correctly following the guidance:

https://google.github.io/styleguide/jsguide.html#features-equality-checks-exceptions