← Back to challenges

A Week Later

JavaScriptHarddatesstringsformatting

Instructions

Create a function which takes in a date as a string, and returns the date a week after.

Examples

weekAfter("12/03/2020") ➞ "19/03/2020"

weekAfter("21/12/1989") ➞ "28/12/1989"

weekAfter("01/01/2000") ➞ "08/01/2000"

Notes

  • Note that dates will be given in day/month/year format.
  • Single digit numbers should be zero padded.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.