Linked Questions

512 votes
5 answers
172k views

What is the difference between the following lines of code? //Function declaration function foo() { return 5; } //Anonymous function expression var foo = function() { return 5; } //Named function ...
107 votes
8 answers
80k views

What's the difference between these two ways of declaring a function? function someFunc() { ... } var someFunc = function() { ... } I'm not asking in the technical sense. I'm not asking which is ...
71 votes
4 answers
36k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} There are two possible methods for pulling out a function in Javascript: var foo = function() { ... }...
Billy ONeal's user avatar
58 votes
7 answers
18k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the difference between: function sum(x, y) { return x+y; } // and var sum = function (x, ...
Rushi's user avatar
  • 1,662
48 votes
5 answers
41k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} In JavaScript, what's the purpose of defining a variable as a function? I've seen this convention ...
33 votes
3 answers
10k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} Suppose we are inside a function and not in the global namespace. function someGlobalFunction() { ...
Fletcher Moore's user avatar
50 votes
1 answer
33k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} Declaring functions in JavaScript I've seen 2 different syntaxes for defining functions in ...
31 votes
2 answers
25k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} are they the same? I've always wondered
31 votes
5 answers
2k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What is the difference between a function expression vs declaration in Javascript? I am aware of ...
Om Shankar's user avatar
  • 8,069
22 votes
2 answers
36k views

I'm trying to send a simple message from a child document (an iframe) back to its direct parent using the window.postMessage API. Within the parent document I have the following: window....
27 votes
3 answers
2k views

Is there any difference between function MyFunc() { // code... } and var MyFunc = function() { // code... }; in JavaScript?
altso's user avatar
  • 2,400
8 votes
5 answers
29k views

On the window.onload event, I would like a function to be called. If I define it as given below, the function does not get called. try { window.addEventListener("load", initialiseTable, false); }...
101V's user avatar
  • 502
4 votes
2 answers
1k views

I'm going through this blog about the difference between function declarations and function expressions. It gives these two examples. They call the first an "anonymous function expression" and the ...
3 votes
1 answer
2k views

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} I've been going through CodeAcademy's Javascript courses, and a few things have gone over my head. I ...
JVG's user avatar
  • 21.3k
4 votes
6 answers
770 views

Possible Duplicate: Javascript: var functionName = function() {} vs function functionName() {} Way 1: function fancy_function(){ // Fancy stuff happening here } Way 2: var fancy_function = ...
Erik Escobedo's user avatar

15 30 50 per page
1
2 3 4 5
...
43