typeof actual === 'string' && (actual === value || typeof value !== 'string')
This will return true
if and only if actual
is a string, and either actual === value
, or value
is not a string.
typeof actual === 'string' && actual === value
This will return true
if and only if actual
is a string and either actual === value
.
In other words, the first condition returns true if value
is anything other than a string, whereas the second condition will only return true if it is a string, and strictly equal to actual
.