Fundamentals
Strings
Data Types
Fundamentals
Strings
Data Types
minutes = -> i { '%d:%02d' % [i / 60, i % 60] }
function minutes(num){return num % 60 < 10 ? Math.floor(num/60) + ':' + '0' + (num % 60) : Math.floor(num/60) + ':' + (num % 60)}- minutes = -> i { '%d:%02d' % [i / 60, i % 60] }
Test.describe("Solution") do Test.it("Did you make the correct conversion?") do Test.assert_equals(minutes.(0), "0:00", "Better try again!") Test.assert_equals(minutes.(1), "0:01", "Better try again!") Test.assert_equals(minutes.(18), "0:18", "Better try again!") Test.assert_equals(minutes.(13267), "221:07", "Better try again!") Test.assert_equals(minutes.(985), "16:25", "Better try again!") Test.assert_equals(minutes.(351), "5:51", "Better try again!") Test.assert_equals(minutes.(156113), "2601:53", "Better try again!") end end
describe("Solution", function(){it("Did you make the correct conversion?", function(){Test.assertEquals(minutes(0), "0:00", "better try again");Test.assertEquals(minutes(1), "0:01", "better try again");Test.assertEquals(minutes(18), "0:18", "better try again");Test.assertEquals(minutes(13267), "221:07", "better try again");Test.assertEquals(minutes(985), "16:25", "better try again");Test.assertEquals(minutes(351), "5:51", "better try again");Test.assertEquals(minutes(156113), "2601:53", "better try again");});});- Test.describe("Solution") do
- Test.it("Did you make the correct conversion?") do
- Test.assert_equals(minutes.(0), "0:00", "Better try again!")
- Test.assert_equals(minutes.(1), "0:01", "Better try again!")
- Test.assert_equals(minutes.(18), "0:18", "Better try again!")
- Test.assert_equals(minutes.(13267), "221:07", "Better try again!")
- Test.assert_equals(minutes.(985), "16:25", "Better try again!")
- Test.assert_equals(minutes.(351), "5:51", "Better try again!")
- Test.assert_equals(minutes.(156113), "2601:53", "Better try again!")
- end
- end