var x = 'x'
x-'m'||console.log('True 1')
// logs True, should be false
var x = '2'
x-2||console.log('True 2')
// logs True
var x = '3'
x-2||console.log('True 3')
// logs False
Why does this if else shorthand always return true when using a string? How can it be fixed?
I learnt this from here