johnny
johnny

Reputation: 1251

Parenthesis for anonymous JavaScript functions

Are they the same?

var multiply = function () {
      //..
      }();

var multiply1 = (function () {
      //..
      }());

Upvotes: 5

Views: 176

Answers (3)

nicosantangelo
nicosantangelo

Reputation: 13736

As mquander said in that case they are the same, but if you want to read a little more about it you can go to: An Important Pair of Parens.

Upvotes: 9

jfriend00
jfriend00

Reputation: 708156

They seem to work the same here in Chrome: http://jsfiddle.net/jfriend00/G5DZp/

Upvotes: 2

mqp
mqp

Reputation: 72015

Yes, they are totally identical.

Upvotes: 4

Related Questions