'1' - '1' / 2 = ? , Can you find the answer ?

Heru Hartanto - Sep 18 '21 - - Dev Community

I just found out some 🙀 funny things about javascript, If someone able to explain I really appreciate


'A'+'A'
// output 'AA'

'1'+'1'
// output '11'

// Okay that make sense but ...

'1'+'1'*2
// output 12 


'1'+'1'/2
// output 10.5

// It's start getting weird then ....


'1'-'1' 
// output 0

'1'-'1'/2
// output 0.5

// It's correct , but why ? 

Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player