← Back to challenges

Volume of a Box

JavaScriptHardmathobjectsgeometry

Instructions

Create a function that takes an object argument sizes (contains width, length, height keys) and returns the volume of the box.

Examples

volumeOfBox({ width: 2, length: 5, height: 1 }) ➞ 10

volumeOfBox({ width: 4, length: 2, height: 2 }) ➞ 16

volumeOfBox({ width: 2, length: 3, height: 5 }) ➞ 30

Notes

  • Remember that the values are in an object.
  • Volume is length * width * height.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Recreating the abs() Function