← Back to challenges

Convert Age to Days

JavaScriptEasyalgebraalgorithmsmath

Instructions

Create a function that takes the age in years and returns the age in days.

Examples

calcAge(65) ➞ 23725

calcAge(0) ➞ 0

calcAge(20) ➞ 7300

Notes

  • Use 365 days as the length of a year for this challenge.
  • Ignore leap years and days between last birthday and now.
  • Expect only positive integer inputs.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Buggy Code (Part 1)