Convert Celsius to Fahrenheit
Apply the temperature conversion without rounding the result.
function toFahrenheit(value) { return value * 9 / 5 + 32; }
Input & expected output
Input
20Expected output
68The edge case
Input
-40Expected output
-40Know the limits
- This is a mathematical conversion. It does not enforce a physical temperature range.
The function above is the implementation used by the lab. The lab validates JSON types and caps size before execution; include equivalent validation when accepting untrusted input in your application.
Source & maintenance
Based on Convert Celsius to Fahrenheit from the original 1loc collection by Nguyen Huu Phuoc, with mizanmahi. Copyright (c) 2020 phuoc-ng. MIT licensed.
Curated implementation; explicit input bounds, edge cases, local fixtures and rebuilt presentation. Original MDX retained as inert source evidence.
Maintained by Oveyon. Source commit: 14b481cf60df. Read the license.
Keep exploring
- Convert hex to RGB — Expand #rgb if needed and read the red, green and blue channels.
- Convert URL parameters to object — Read a query string into an object; repeated keys become arrays.
- Convert 3 digits color to 6 digits color — Double each digit of a #rgb color.