asked 65.1k views
4 votes
How would you code 135 minutes and turn it into 2 hours and 15 minutes, using integer/modular division, in Javascript?

135 to 2h15

1 Answer

6 votes

mins = 135;

alert("There are "+(Math.floor(mins/60))+" hour(s) and "+(mins%60)+" min(s).");

That's how I would do it. I hope this helps!

answered
User Goul
by
8.5k points

No related questions found