Here is a snippet of code I am currently working with:
constructor(data) {
this.date = data.date && new Date(data.date) || undefined
}
I'm wondering if it is necessary or considered good practice to include || undefined
. If the value of data.date
is empty, will this expression return null? Am I interpreting this correctly?