老师检查一下是否正确
来源:3-19 编程练习
慕仙8428333
2019-04-17 15:53:25
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
var a="50px",b="px50",c="050px",d="50.12345",e="50.123px45";
console.log(parseFloat(a));
console.log(parseFloat(b));
console.log(parseFloat(c));
console.log(parseFloat(d));
document.write(typeof(parseFloat(a)));
document.write(typeof(parseFloat(b)));
document.write(typeof(parseFloat(c)));
document.write(typeof(parseFloat(d)));
</script>
</body>
</html>
1回答
好帮手慕慕子
2019-04-17
同学你好,这里需要添加对最后一个变量e的数字行转换,和检测转换后的数据类型操作,查看最后的输出结果。例:

如果帮助到了你, 欢迎采纳
祝学习愉快~~
相似问题