← Back to challenges

Divide a Fraction by Two

JavaScriptHardmathnumbers

Instructions

Create a function that takes a fractional number as a string for its argument and returns its half.

Examples

fractionHalf("1/2") ➞ "1/4"

fractionHalf("6/8") ➞ "3/8"

fractionHalf("3/8") ➞ "3/16"

Notes

Always return the simplified fraction (reduced to its lowest terms).

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: House of Cards