Javascript for Statement convert fahrenheit to celsius

Description

Javascript for Statement convert fahrenheit to celsius


let degFahren = [212, 32, -459.15];
let degCent = [];
let loopCounter;//from   www. j a  va 2 s.  c  om

for (loopCounter = 0; loopCounter <= 2; loopCounter++) {
    degCent[loopCounter] = 5/9 * (degFahren[loopCounter] - 32);
}

for (loopCounter = 2; loopCounter >= 0; loopCounter--) {
    console.log("Value " + loopCounter + " was " + degFahren[loopCounter] + 
                   " degrees Fahrenheit");

    console.log(" which is " + degCent[loopCounter] + 
                   " degrees centigrade");
}



PreviousNext

Related