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 if (m > 10) {
- console.log(`${h}:${m}`);
- }
- } else if (m >= 60 && h == 23) {
- h += 1;
- h = h % 24;
- m = m % 60;
- if (m < 10) {
- console.log(`${h}:0${m}`)
- } else if (m > 10) {
- console.log(`${h}:${m}`)
- }
- }
- else if (m >= 60 && h < 23) {
- h += 1;
- m = m % 60;
- if (m < 10) {
- console.log(`${h}:0${m}`)
- } else if (m > 10) {
- console.log(`${h}:${m}`)
- }
- }
- }
- timePlusMins(["12", "55"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement