So I have written allot of javascript over the years. I have been writing JavaScript professionally since 1997 and the browser wars, so that is allot of semicolons. I never really thought to wonder about it, just inserted them in the appropriate place at some line terminations.
Good.
function add(event, callback) {
if (fn_p(event)) {
callback = event
event = this.default_event }
insert_callback.call(this)
return this
function insert_callback() {
if (this.value) fire(this, event, callback)
else add_callback(this, event, callback) }
}
}
Bad
function add(event, callback) {
if (fn_p(event)) {
callback = event;
event = this.default_event;
}
insert_callback.call(this);
return this;
function insert_callback() {
if (this.value) {
fire(this, event, callback);
}
else {
add_callback(this, event, callback);
}
}
}
But, this is all well and good from a human readability standpoint, but I have serious doubts about the adverse reactions from putting good human readable code through javascript uglification and minification.
No comments:
Post a Comment