[Home] > Snippets  > Languages  > JavaScript  > Misc  >  Convert Celsius to Fahrenheit

Convert Celsius to Fahrenheit

JavaScript

const celsiusToFahrenheit = (celsius) => (celsius * 9) / 5 + 32

TypeScript

const celsiusToFahrenheit = (celsius: number): number => (celsius * 9) / 5 + 32

Examples

celsiusToFahrenheit(15) // 59
celsiusToFahrenheit(0) // 32
celsiusToFahrenheit(-20) // -4