← Back to challenges

Kinetic Energy

JavaScriptHardphysicsmathnumbers

Instructions

Kinetic energy can be calculated with the following formula:

KE = 1/2mv²

  • m is mass in kg
  • v is velocity in m/s
  • KE is kinetic energy in J

Return the Kinetic Energy in Joules, given the mass and velocity. For the purposes of this challenge, round answers to the nearest integer.

Examples

kineticEnergy(60, 3) ➞ 270

kineticEnergy(45, 10) ➞ 2250

kineticEnergy(63.5, 7.35) ➞ 1715

Notes

Expect only positive numbers for inputs.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Volume of a Box