<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>javascript不同数据类型的转换</title>
</head>
<body>
<script type="text/javascript">
/*
var result = 100 + "100";//声明一个变量
document.write( "计算出的结果是:" + result + "<br/>" );
document.write( "计算出的结果是:" + typeof result + "<br/>" );
document.write( typeof ("计算出的结果是:" + typeof result + "<br/>") );
*/
/*
var userEnterNumber = prompt( "请输入数字","" );
document.write( typeof userEnterNumber );//返回字符串类型
document.write( "<br/>" );
document.write( parseFloat( userEnterNumber ) );
document.write( "<br/>" );
document.write( parseInt( userEnterNumber ) );
document.write( "<br/>" );
userEnterNumber = Number ( userEnterNumber );
document.write( userEnterNumber );
document.write( "<br/>" );
document.write( typeof userEnterNumber );
document.write( "<br/>" );
*/
var userEnterNumber = Number ( prompt("请输入数字","") );
myCalc = 100 + userEnterNumber;
document.write( myCalc );
document.write("<br/>");
document.write( typeof myCalc );
</script>
</body>
</html>