Closed markogresak closed 3 years ago
Boolean(1.1)
// true
Hum... interesting.
@markogresak could you open a PR?
Added with an explanation. Will be published soon.
:tada: This issue has been resolved in version 1.17.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I was goofing around with JS weirdness today, and I found this behaviour, which took me some time to explain to myself. Maybe it could be included in the file?
It started off with the basic type coercion, which worked as expected:
My initial assumption was that the value is cast to
Boolean
. For this simple example, that assumption would holdBut it broke when trying the following:
Given my original assumption, I was a bit confused because I know
Boolean(1.1) -> true
.But the true explanation to the first snippet is:
Meaning that
true
/false
is cast to and compared asNumber
.