JavaScript truthiness in boolean to numbers comparison

前端 未结 3 1767
别跟我提以往
别跟我提以往 2020-12-10 18:49

I\'m new to JavaScript and I\'m trying to learn it from internet resources. While I\'m aware that there will plenty of cr*p material, one thing most people seemed to agree i

3条回答
  •  一向
    一向 (楼主)
    2020-12-10 19:34

    The boolean true constant is promoted to a number, that being 1.

提交回复
热议问题