【发布时间】:2015-03-24 01:50:23
【问题描述】:
我找到了这段代码sn-p:
;
100% function($) { // WTF?
var _true_ = true; // WTF?
var _false_ = false; // WTF?
var go = function(location, date) {
location || (location = {});
var result = _false_;
if (date && date.day) {
result = geoService.go(location, date);
}
return !!result;
}
var process = function(func) {
var args = [].prototype.slice.call(arguments, 1);
return function() {
return func.apply(this, args);
}
}
// ...
}(jQuery, undefined);
在这里:http://www.dofactory.com/products/javascript-jquery-design-pattern-framework (抱歉,页面上没有找到 id-s)
我不明白这些部分在做什么:
- 第二行的“100%”
- 3-4 行中的
var _true_ = true;和var _false_ = false;分配
我很好奇,这些的目的是什么。
【问题讨论】:
标签: javascript idioms