Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need explanation with javascript functions  RSS feed

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!