How to use Math.floor() method in Javascript

Description

The Math.floor() method is the floor function. Math.floor() rounds numbers down to the nearest integer value.

Example


console.log(Math.floor(25.9)); //25 
console.log(Math.floor(25.5)); //25 
console.log(Math.floor(25.1)); //25 

The code above generates the following result.





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window