What does = +_ mean in JavaScript

前端 未结 12 1949
南笙
南笙 2020-11-22 11:37

I was wondering what the = +_ operator means in JavaScript. It looks like it does assignments.

Example:

hexbin.radius = function(_)         


        
12条回答
  •  生来不讨喜
    2020-11-22 12:20

    It's not =+. In JavaScript, + means change it into number.

    +'32' returns 32.

    +'a' returns NaN.

    So you may use isNaN() to check if it can be changed into number.

提交回复
热议问题