This is the task given to me
1.The forecast today is 294 Kelvin. To start, create a variable named kelvin, and set it equal to 294.
We will not change the value saved to kelvin. Choose the variable type with this in mind.
2.Celsius is similar to Kelvin — the only difference is that Celsius is 273 degrees less than Kelvin.
Let’s convert Kelvin to Celsius by subtracting 273 from the kelvin variable. Store the result in another variable, named celsius.
3.Use this equation to calculate Fahrenheit, then store the answer in a variable named fahrenheit.
In the next step we will round the number saved to fahrenheit. Choose the variable type that allows you to change its value.
4.When you convert from Celsius to Fahrenheit, you often get a decimal number.
Use the .floor() method from the Math library to round the Fahrenheit temperature. Save the result to the fahrenheit variable.
5.Use console.log and string interpolation to log the temperature in fahrenheit to the console as follows: The temperature is TEMPERATURE degrees fahrenheit.
Use string interpolation to replace TEMPERATURE with the value saved to fahrenheit.
6.You can make the Kelvin Weather project more interactive by asking the user what the current Kelvin temperature is through a prompt pop-up window.
prompt is a JavaScript function that will generate a pop-up window that asks the user for input, then it will assign their input to a variable.
Make the kelvin variable equal to this code:
const kelvin = prompt(‘What is the Kelvin temperature today?’);
Below is the code i have written, but i get a notification of “SyntaxError: Missing initializer in const declaration”
const kelvin = 294;//I choosed const variable because theis variable is not going to change it’s value
const Celsius ;
var Celsius = kelvin - 273;
let fahrenheit;
var fahrenheit = Celsius * (9/5) + 32;
// I wrote the formula of converting from fahrenheit to Celsius in order to set the fahrenheit varaible in it’s value
fahrenheit = Math.floor(fahrenheit);
console.log(The temperature is ${fahrenheitE} degrees fahrenheit
);
const kelvin = prompt(‘What is the Kelvin temperature today?’);