What does a + function() { } notation do?
本问题已经有最佳答案,请猛点这里访问。
我正在读一个javascript文件,这个文件是由一个拥有修改CSS和其他功能的人编写的,我在javascript中不是专业级的;我看到了一段类似的代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + function(a) { "use strict"; function b() { var a = document.createElement("bootstrap"), b = { WebkitTransition:"webkitTransitionEnd", MozTransition:"transitionend", OTransition:"oTransitionEnd otransitionend", transition:"transitionend" }; for (var c in b) if (void 0 !== a.style[c]) return { end: b[c] } } a.fn.emulateTransitionEnd = function(b) { var c = !1, d = this; a(this).one(a.support.transition.end, function() { c = !0 }); var e = function() { c || a(d).trigger(a.support.transition.end) }; return setTimeout(e, b), this }, a(function() { a.support.transition = b() }) }(window.jQuery), + function(a) { |
添加+符号对javascript函数有什么作用?代码很长,所以我只是粘贴我认为相关的内容。
我找到了我的答案,这是另一个的重复帖子,但是对于那些想要完整源代码的人,它在这里源代码
看看同一主题上的另一个问题(javascript加上在函数名前面的符号),下面是答案:
It forces the parser to treat the part following the + as an
expression. This is usually used for functions that are invoked
immediately
来源-https://stackoverflow.com/a/13341710/970847
It forces the parser to treat the part following the + as an
expression. This is usually used for functions that are invoked
immediately.
从这里开始,在函数名前面加上javascript符号