Animations
API
Arrays
Async
Basics
Challenges
Classes
Console
Dates
Debugging
DOM Elements
DOM Methods
DOM Properties
Event Listeners
Flow Control
Forms
Functions
Global Functions
JSON
Keywords
Libraries (3rd party)
Math
Modules
Objects
Snippets
String
Types
Widgets
Window Object
The Math object contains a lot of helpful, common methods. It's kind of a utility class. Math.floor()
rounds a number
down to the nearest integer.
let demo1 = document.getElementById("demo1");
demo1.innerHTML = Math.floor(4.9);
let seconds = 115;
let demo2 = document.getElementById("demo2");
demo2.innerHTML = Math.floor(seconds/60);
What if you wanted to know the minutes within seconds?