javascript - How to format float 0.5 to float 0.50 -
update: seem bug. github issue link: https://github.com/freecodecamp/freecodecamp/issues/10491 ================= i studying freecodecamp course-"exact change". need convert float-type-data 0.5 float-type-data 0.50, have try solutions not work! float.tofixed(2) return string-type "0.50", , if use parsefloat("0.50") return float-type-data 0.5! how can solve issue? follow requirement screenshot, had try float 0.5, failed pass! you have slight misconception numbers in javascript. javascript numbers not have trailing zeroes after decimal point. if requirement 0.50 displayed on screen, must string "0.50" , , not number, 0.5 .