parseInt 转化字符串为数字不知为什么失败
来源:2-3 数据类型及转换
越狱丶少年
2020-02-26 00:31:35
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js.js"></script>
<title></title>
</head>
<body>
</body>
</html>
var str="123";
console.log(str+1);
console.log(parseInt(str));
console.log(str+1);

1回答
你好,console.log(str+1);
应该改为
console.log(parseInt(str)+1);
如果解决您的问题请采纳,祝学习愉快!
相似问题