Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
Besides, null is a perfectly valid value for a property, just as 0. Working with API Platform, I couldn’t tell the number of times I used this kind of statement:
if (property || property === null) {
// do some stuff
}
Probably just as much as
if (property || property === 0) {
//do some stuff
}
In the case of a non-existing property, the value would be undefined rather than null.
And while == and != exist in JavaScript, most linters will throw an error and require a === and !== instead as they should be avoided.
null == undefined // true null === undefined // false
Besides, null is a perfectly valid value for a property, just as 0. Working with API Platform, I couldn’t tell the number of times I used this kind of statement:
if (property || property === null) { // do some stuff }
Probably just as much as
if (property || property === 0) { // do some stuff }