Math Object in Java Script

 Math : 

Math object helps us to perform a mathematical operation 

// console.log(Math.PI);
//-----------------------------------
// console.log(Math.round(3.53273));
//--------------------------------------
// console.log(Math.pow(4.2,8));
// console.log( Math.round(Math.pow(4.2,8)));
//--------------------------------------
// console.log( Math.sqrt(16));
//--------------------------------------
// console.log( Math.abs(-16)); //return positive value always
// //--------------------------------------
// console.log( Math.ceil(99.1));   // alawys increment
// console.log( Math.round(99.41)); 
// //--------------------------------------
// console.log( Math.floor(99.61));  //remains same
// console.log( Math.round(99.41)); 
// //--------------------------------------
// console.log(Math.min(0,60,37,-34,43));
// console.log(Math.max(0,60,37,-34,43));
//--------------------------------------
// console.log(Math.round(Math.random()*5));
// console.log(Math.floor(Math.random()*5));
//--------------------------------------
// console.log(Math.trunc(4.5)) //return integer part of the number
// console.log(Math.trunc(-4.8)) //return integer part of the number


// practice time 
let a = 8.9
console.log(Math.trunc(a));
console.log(Math.floor(a));
console.log(Math.ceil(a));


0 Comments