Hey Folks I am just starting out with JavaScript and am following the resource book for the course I am on.

One of the exercises is to write an external JavaScript as below which produces the following output:

Power is Off
Number is Ten

the problem is that I am only getting:

Number is Ten

function init()

{
   var panel=document.getElementById("panel");
   var flag=false;
   var num=10;

   if (flag)
   { panel.innerHTML="Power is On"; }
   else
   { panel.innerHTML="Power is Off"; }

   if (num === 5)
   { panel.innerHTML="<br>Number is Five"; }
   else if (num === 10)
   { panel.innerHTML="<br>Number is Ten"; }
   else
   { panel.innerHTML="<br>Number is Neither Five or Ten"; }

}

window.onload=init;

same mistake as in your other function. you're overwriting the value, not adjusting it.