Напишите код JS для выполнения преобразования температуры. Используйте подсказку, чтобы ввести температуру для преобразования.
1.Write the JS code to perform the temperature conversions.2.Use prompt to enter the temperature for conversion.3.Create 2 functionsto perform the conversions:•toCelsius()•toFahrenheit()4.Use the formulas below:To convert Fahrenheit to Celsius:celcius =(5/9)*(fahrenheit-32)To convert Celsius to Fahrenheit:fahrenheit = (Celsius* 9/5) + 325.For function, toCelsius(), both Celsius(calculated value) and Fahrenheit(argument) have to return to the call function.Declare the call function as : vararr1=toCelcius(212);(note: arr1 is an array)6.For function, toFahrenheit(), both Fahrenheit (calculated value) and Celsius (argument) have to return to the call function.Declare the call function as :var arr2=toFahren(100);(note: arr2 is an array)7.For both functions, return the resultsand display using:document.getElementById(“show”) as shown on the right.(Hint1: to display oC or oF, e.g. str=”o”, use str.sup())(Hint2: Use array[ ] to retrieve the return values)Note: correct the result to 2 dec. no. of places
Что я уже пробовал:
HTML:
<title>lab13_challenge <h1>F2C/C2F Temperature Conversions</h1> <br> <p id="show">Display temperature conversions below:</p> Javascript: function click1(){ var quotients= 10/2; var product=6*2; return[quotients,product]; } var arrResult=click1(); document.getElementById("show").innerHTML +=("<br>Quotient is" +arrResult[0]); document.getElementById("show").innerHTML +=("<br>Product is " +arrResult[1]);
Dave Kreskowiak
и у вас был вопрос, который вы забыли задать?