GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Need explanation with javascript functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Need explanation with javascript functions" Watch "Need explanation with javascript functions" New topic
Author

Need explanation with javascript functions

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi, I asked this a long time ago... I already forgot so I'm asking again...


How does

var myVar = myFunction();

differ from...


var myVar = myFunction;


thanks...


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Runs function and stores value into myVar
var myVar = myFunction();

Stores the function into the variable myVar
var myVar = myFunction;

You would be able to do

myVar(); and it will execute the function store in it.

Eric
 
GeeCON Prague 2014
 
subject: Need explanation with javascript functions