Thursday, 8 August 2013

Why would one prepend a + to a self-executing function call in javascript? [duplicate]

Why would one prepend a + to a self-executing function call in javascript?
[duplicate]

This question already has an answer here:
JavaScript plus sign in front of function name 3 answers
In the Twitter Bootstrap source, self executing closures are prepended
with a plus sign:
+function ($) { "use strict";
//
// function body goes here
//
}(window.jQuery);
Bootstrap Source
Why is there a + infront of the function? What does this do?
My initial thought is that it attempts to convert the return value to a
number... but what's the point?

No comments:

Post a Comment