Why is this even possible?
console.log('13' % 2);
1
I assume JavaScript just converts the string on its own. I would appreciate any info on this behaviour.
As a starting point: http://ecma-international.org/ecma-262/5.1/#sec-11.5
The ToNumber
operation is performed on the left argument (which results in the left argument being treated as the number, as explained in http://ecma-international.org/ecma-262/5.1/#sec-9.3.1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With