How To Hide Nan (javascript)
I'm learning loops in JavaScript and I'd like to get how to hide all text strings from output.  When alert of skipping was inside @for operator there was no NaN values in output, b
Solution 1:
In your for loop you can skip strings using typeof:
for (loopCounter = 0; loopCounter <=6; loopCounter++)
  {   
   if (typeof(degCent[loopCounter]) != 'number') continue;
   // Calc degCent via function
   degCent[loopCounter] = convertToCentigrade(degFahren[loopCounter]);
   document.write ("Value " + loopCounter + " was " + degFahren[loopCounter] + " degrees Fahrenheit");
   document.write (" which is " + degCent[loopCounter] +  " degrees centigrade<br />");
  }
Post a Comment for "How To Hide Nan (javascript)"