The Temperature Display Challenge involves creating a function that takes an array of forecasted maximum temperatures as input and logs a formatted string to the console. Each temperature in the array should be displayed with the text "degree C" appended to it, and "and" should be added between each pair of temperatures.
Given an array of forecasted maximum temperatures, create a function that logs a formatted string to the console.
function displayTemperature(temperatures) { // Function implementation }
temperatures: An array of forecasted maximum temperatures. Each temperature is an integer.
The function should log a string to the console, where each temperature is displayed with the text "degree C" appended to it, and "and" is added between each pair of temperatures.
const temperatures = [17, 21, 33]; displayTemperature(temperatures); // Output: "17 degree C and 21 degree C and 33 degree C"
No installation is required for this challenge. You can simply copy the provided function displayTemperature and use it in your project.
Import or include the displayTemperature function in your project. Call the displayTemperature function with an array of forecasted maximum##