<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
//方式一:使用parseInt()将字符串转为整数
console.log(parseInt('78'));
//方式二:使用parseFloat()将字符串转为浮点数
console.log(parseFloat('3.94'));
//方式三:使用Number()将字符串转为数字型
console.log(Number('3.94'));
//方式四:利用算数运算符(-,*,/)隐式转换
console.log('12'-1);
</script>
</body>
</html>