Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Need explanation with javascript functions
 
Similar Threads
calling $(document).ready() from else where
c:remove does not remove from all scopes
Session Attribute Values Fom JS
Inheritance Variable assignment
javascript passing value to JSP