← Back to challenges

Javelin Parabolic Throw

JavaScriptHardphysicsmath

Instructions

Write a function that takes initial speed (v in m/s) and throw angle (a in degrees) and returns the maximum height and maximum range reached by javelin as a string.

Examples

javelinThrow(36.7, 45) ➞ "Ymax=34m, Xmax=137m"

javelinThrow(51.3, 20) ➞ "Ymax=16m, Xmax=172m"

javelinThrow(100.1, 89) ➞ "Ymax=511m, Xmax=36m"

Notes

  • Javelin starts moving at h=0m.
  • Gravitational acceleration is g=9.81 m/s^2.
  • All results should be rounded to the nearest whole number.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.