3 ms·
Realistically, if he weren't opting to be as terse as possible, this could be rewritten as: var state; if (typeof behavior.init === "function") { state
by seangrogg 9y ago
Realistically, if he weren't opting to be as terse as possible, this could be rewritten as:
var state;
if (typeof behavior.init === "function") {
state = behavior.init();
} else {
state = {};
}
I do enjoy terse ternary operations but they can get very ugly very quickly. I often stick if/else if I'm writing code for others. As far as choosing another language, write Python that gets executed on Chrome without further trans/compilation and I'll happily consider it.