Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function timePlusMins(input) {
- let h = Number(input.shift());
- let m = Number(input.shift()) + 15;
- if (m < 60) {
- if (m < 10) {
- console.log(`${h}:0${m}`);
- } else {
- console.log(`${h}:${m}`);
- }
- } else if (m >= 60){
- h += 1;
- if (h === 24) h = 0;
- m = m % 60;
- if (m < 10) {
- console.log(`${h}:0${m}`)
- } else {
- console.log(`${h}:${m}`)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement