← Back to challenges

Halloween Day

JavaScriptHarddateslanguage_fundamentalsvalidation

Instructions

Create a function that takes date in the format yyyy/mm/dd as an input and returns "Bonfire toffee" if the date is October 31, else return "toffee".

Examples

halloween(new Date("2013/10/31")) ➞ "Bonfire toffee"

halloween(new Date("2012/07/31")) ➞ "toffee"

halloween(new Date("2011/10/12")) ➞ "toffee"

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Even or Odd?