Subroutines in JavaScript
Here's the script that will be executed:
<script>
function padNumber(the_number){
if (the_number < 10){
the_number = "0" + the_number;
}
return the_number;
}
for (i=0; i<20; i++){
document.write
("Count= " +padNumber(i)+ ".<br>");
}
</script>
And here's what happens when it's executed: