Libraries

  • Math.ceil()

      • The Math.ceil() function returns the smallest integer greater than or equal to a given number.
      • console.log(Math.ceil(.95));
        // expected output: 1
        
        console.log(Math.ceil(4));
        // expected output: 4
        
        console.log(Math.ceil(7.004));
        // expected output: 8
        
        console.log(Math.ceil(-7.004));
        // expected output: -7
        

 

  • Number.isInteger()

    •   The Number.isInteger() method determines whether the passed value is an integer.
    • function fits(x, y) {
        if (Number.isInteger(y / x)) {
          return 'Fits!';
        }
        return 'Does NOT fit!';
      }
      
      console.log(fits(5, 10));
      // expected output: "Fits!"
      
      console.log(fits(5, 11));
      // expected output: "Does NOT fit!"
      

       

 

posted @ 2018-03-29 20:40  Veritas_des_Liberty  阅读(316)  评论(0编辑  收藏  举报