No sample tests.
Typescript translation added, please approve.
This comment is hidden because it contains spoiler information about the solution
You should include how you pass the date parameter
You need to check spans which include the days when Daylight Savings Time begins and ends. Solutions which naively add 24-hour intervals will give the wrong result.
Test.assertEquals(nextFiveDays(new Date(2012, 10, 2)),
'11/3/2012, 11/4/2012, 11/5/2012, 11/6/2012, 11/7/2012',
'Should give correct result when Daylight Savings Time ends');
Test.assertEquals(nextFiveDays(new Date(2013, 2, 7, 23, 59)),
'3/8/2013, 3/9/2013, 3/10/2013, 3/11/2013, 3/12/2013',
'Should give correct result when Daylight Savings Time begins');
I know, I know... dates are hard.
This is doubly tricky for any non-US coders as our dates are not in the format mm/dd/yyyy and it is second nature to ooutput them as dd/mm/yyyy!
There's another kata kicking around somewhere (forget what it's called) that does just this. You end up overriding the function's valueOf function to return the final result. Then you don't have to muck around with the weird command parenthesis and you can just do say('Hi')('Tom') and say('Hi')('Tom')('Jones') to get what you'd expect.
Anyone have an answer to this question?! We are trying to figure out how to make this recursive somehow as well...
I suppose it's a good intro to functions with JS but, really it was easy!
Yeah, you're right.
Did you actually read that post? They show that it hardly matters for 100,000 iterations, and we already know this only needs to handle 2 strings.
How to generalise the function to accept more number of parathesis
The function has to accept n number of paranthesis