09 Nov Friday 19:00 JavaScript Homework 21.11.05.
Question:
Examine the following function definition. Can you spot any problems with the definition? If so, how can you fix the problems?
function format(ohmage)
{
var result;
if ohmage >= 1e6
{
ohmage = ohmage / 1e6;
result = ohmage + " Mohms";
}
else
{
if (ohmage >= 1e3)
ohmage = ohmage / 1e3;
result = ohmage + " Kohms";
else
result = ohmage + " ohms";
}
alert(result);
Sorry, the comment form is closed at this time.