I was working with TypeScript today and I ran into a JavaScript problem that caused me some issues.
I needed to fix the number of decimal places in a temperature calculation example.
This is my original TypeScript code.
let printOutput = (fahrenheit: number, celsius: number) => { console.log(`${fahrenheit}f = ${celsius}c.`); }; let convert = (fahrenheit: number) => { let celsius = ((fahrenheit - 32) * (5 / 9)); return celsius; }; let fahrenheit = 100; let celsius = convert(fahrenheit); printOutput(fahrenheit, celsius); Returns. ...