Easy
You're working on a weather forecasting app that needs to format temperature values. Complete the missing code in the following utility function that converts temperatures and handles edge cases
1const formatTemperature = (value, fromUnit = 'C') => {2 if (typeof value !== 'number') return 'Invalid input';3 if (value === null || isNaN(value)) return 'N/A';45 // Missing conversion logic here67 return {8 celsius: `${celsius.toFixed(1)}°C`,9 fahrenheit: `${fahrenheit.toFixed(1)}°F`10 };11};1213console.log(formatTemperature(25)); // Should output: { celsius: "25.0°C", fahrenheit: "77.0°F" }14console.log(formatTemperature(98.6, 'F')); // Should output: { celsius: "37.0°C", fahrenheit: "98.6°F" }