Celsius para fahrenheit


#1

My code is good? How can I improve it?
—I just took the javascript course for now.

function Celsius(Fahrenheit) {
	return 5 * (Fahrenheit - 32) / 9;
}

function Fahrenheit(Celsius){
	return (Celsius * 9 / 5) + 32;
}

// Fahrenheit to Celsius
console.log('A temperatura é: ' + Celsius(/*Fahrenheit*/) + "C°");

//Celsius to Fahrenheit
console.log('A temperatura é: ' + Fahrenheit(/*celsius*/) + 'F°');

#2

If it works, it needs no improvement. However as a challenge you could try refactoring it from ES5 to ES6 using arrow functions and string templates. Let us know what you come up with.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.