在JavaScript中=+_意味着什么?我想知道= +_运算符在JavaScript中的意思。看上去是做作业的。例子:hexbin.radius = function(_) {
if (!arguments.length)
return r;
r = +_;
dx = r * 2 * Math.sin(Math.PI / 3);
dy = r * 1.5;
return hexbin;};
3 回答

天涯尽头无女友
TA贡献1831条经验 获得超9个赞
_
只是传递给函数的参数。 hexbin.radius = function(_) { // ^ It is passed here // ...};
在下一行 r = +_;
+
infront转换该变量( _
)到一个数字或整数值,并将其赋值给变量。 r
+=

繁星淼淼
TA贡献1775条经验 获得超11个赞
=+
=
+
_
i = + 5;or j = + i;or i = + _;
=+
y = +'5'x = y +5alert(x);
用途:y
5
=+
否则:
y = '5'x = y +5alert(x);
_
_ = + '5'x = _ + 5alert(x)
此外,~
y = ~~'5' // notice used two time ~x = y + 5alert(x);
~
添加回答
举报
0/150
提交
取消