js中的x=x+1、x++最后得到的是字符串拼接结果
var x=1
typeof(x+1) //’string’
typeof(x-1) //’number’
typeof(+x) //’number’
typeof(-x) //’number’
typeof(++x) //’number’
可以用++x替换
js中的x=x+1、x++最后得到的是字符串拼接结果
var x=1
typeof(x+1) //’string’
typeof(x-1) //’number’
typeof(+x) //’number’
typeof(-x) //’number’
typeof(++x) //’number’
可以用++x替换
本文标题:js +1问题
本文链接:https://www.haomeiwen.com/subject/grkhrktx.html
网友评论