JavaScript原始类型-number

2021-05-29 07:03

阅读:418

YPE >

标签:最大值   ati   osi   false   java   十进制   min   number   content   

html>
    
    
    
    Document
    
        // number
        // 整数,小数,特殊值

        // 整数
        // 十进制 结果:86
        // var num = 86;
        // console.log(num);

        // 八进制 0 ~ 7 结果:56
        // var num = 070;
        // console.log(num);

        // 十六进制 0 ~ 9 a ~ f  结果:31
        // var num = 0x1f;
        // console.log(num);

        // 小数  结果:5.01
        // var num = 5.01;
        // console.log(num);

        // 浮点数的科学计数法  结果:56170000
        // var num = 5.617e7; // 5.617 * 10^7
        // console.log(num);

        // 最大值 结果:1.7976931348623157e+308
        // var num = Number.MAX_VALUE;
        // console.log(num);

        // 最小值 结果:5e-324
        // var num = Number.MIN_VALUE;
        // console.log(num);

        // 正无穷 结果:Infinity
        // var num = Number.POSITIVE_INFINITY;
        // console.log(num);

        // console.log(3 
        // var num = Number.POSITIVE_INFINITY * 1.1;
        // console.log(num); // 返回的结果是Infinity
        // console.log(num > Number.POSITIVE_INFINITY);// 返回的结果是false
        // console.log(isFinite(num)); // 返回的结果是false        
        
        // num = 5;
        // console.log(isFinite(num));// 返回的结果是true

        // NaN
        // var num = NaN;
        // console.log(num); // 返回的结果是NaN
        // console.log(num == NaN);// 返回的结果是false
        // console.log(isNaN(num));// 返回的结果是true
    

JavaScript原始类型-number

标签:最大值   ati   osi   false   java   十进制   min   number   content   

原文地址:https://www.cnblogs.com/Friday1/p/14772002.html


评论


亲,登录后才可以留言!