• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Math Related / Return the largest integer less than or equal to a number

Return the largest integer less than or equal to a number

Return the largest integer less than or equal to a number

Returns the largest integer (whole number) less than or equal to a number.

// returns 42
Math.floor(42);

// returns 3
Math.floor(3.14);

// Returns -4
Math.floor(-3.14);

Source

https://vanillajstoolkit.com/reference/numbers/math-floor/

Math Related

Related Snippets:

  • Generating random numbers with JavaScript
  • Calculate the midpoint between two pairs of (x,y) points
  • The JavaScript function Math.pow()
  • Get the largest number from a set of numbers

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers