猿问
js中加一个+是什么意思?
我在 reactjs 中有一个条件,它以
+this.state.isCompleted
我们为什么要写作
+
?
白衣非少年
浏览 148
回答 1
1回答
慕森王
是强制转换为numberconst str = '1'const bool = falseconst fail = 'isNan?'const num = +strconst numBool = +boolconst numFail = +failconsole.log(typeof num, typeof numBool, numFail)
0
0
0
随时随地看视频
慕课网APP
相关分类
JavaScript
我要回答