| 1234567891011121314151617181920 |
- // Global scope (convertFahrenheitToCelsicius, tempOne, tempTwo)
- // Local scope (fahrenheit, celsius)
- // Local scope (isFreezing)
- let convertFahrenheitToCelsius = function(fahrenheit) {
- let celsius = (fahrenheit - 32) * (5/9)
- if (celsius <= 0) {
- let isFreezing = true
- }
- return celsius
- }
- // Call a couple of times (32 -> 0) (68 -> 20)
- let convertedTemp = convertFahrenheitToCelsius(32)
- let otherConvertedTemp = convertFahrenheitToCelsius(68)
- // Print the converted values
- console.log(convertedTemp)
- console.log(otherConvertedTemp)
|