If you gaze long into an abyss, the abyss also gazes into you, avoiding the empty void in JS
Recently, I came across an interesting scenario while working with list checks in JavaScript. Take a look at the following code: appointment.serviceRequests?.every( serviceRequest => serviceRequest.createdMethod === ServiceRequestMethods.INTEGRATED, ); At first glance, it seems like we're checking if all serviceRequests in an appointment were created using a specific method (INTEGRATED). However, there's a subtle issue here: what if serviceRequests is an empty list?

Recently, I came across an interesting scenario while working with list checks in JavaScript. Take a look at the following code:
appointment.serviceRequests?.every(
serviceRequest => serviceRequest.createdMethod === ServiceRequestMethods.INTEGRATED,
);
At first glance, it seems like we're checking if all serviceRequests
in an appointment were created using a specific method (INTEGRATED
). However, there's a subtle issue here: what if serviceRequests
is an empty list?