I am confused on why something works. Here's the issue :
<p>{params.value !==undefined || params.value!==null ? params.value.split("T")[0] : "no deadline set"}</p>
Triggers this error : Cannot read properties of null (reading 'split').
I translate the code as "if value is not undefined or not null display params.value.split("T")[0], else "no deadline set". But when I write this :
<p>{params.value && params.value !== undefined ? params.value.split("T")[0] : "no deadline set"}</p>
which I translate by if value AND value is not undefined display params.value.split("T")[0] else "no deadline set" It works.
I am confused on :
- Why we use && with same variable, makes no sense to me
- My understanding is that null and undefined are different, so when !== undefined, null should be params.value.split("T")[0], which will trigger the error (but it's not)