Divide a Fraction by Two

Published by Deep Xavier in

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).

Watch a quick demo on how Edabit works.