View Single Post

Old 11-20-2006, 03:46 AM   #12 (permalink)
Dyndrilliac

Enlightened
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,661
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via AIM to Dyndrilliac Send a message via MSN to Dyndrilliac Send a message via Yahoo to Dyndrilliac
Default

Your function isn't returning a numerical value. What happens is that at compile time (at the time that the machine compiles the javascript code and processes the output), all functions are executed. Since your function is calling a function and outputting the data to screen (instead of returning the value to the invoker), the function gets resolved to it's output, and so the number "19" gets written to the screen. The original output gets printed, where you called your function. And since you didn't return a value, the value that you make reference to is undefined.
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.
Dyndrilliac 15 0FF11|\|3   Reply With Quote