• 2.8.JavaScript不同数据类型转换


    <!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>



  • 相关阅读:
    weblogic复现利用系列-2019
    weblogic复现利用系列-2020
    Python3编码解码与数据类型转换
    weblogic复现利用系列-2017
    weblogic从ssrf到redis获取shell
    fastjson反序列化复现
    shiro721复现
    Shiro550复现和挖掘思路
    RMI反序列化
    手写一个admin 组件------STARK
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2398092.html
Copyright © 2020-2023  润新知