Re:Top-5-javascript-oneliners ...
by portmanteaufu on Sunday July 01, 2012 @12:17PM
(#4185180)
I don't consider something like:
function is_empty(obj){if(obj instanceof Array){return obj.length===0;}else if(obj instanceof Object){for(var i in obj)return false;return true;}else return !obj;
to be a one-liner simply because it was crammed into one line.
function is_empty(obj){if(obj instanceof Array){return obj.length===0;}else if(obj instanceof Object){for(var i in obj)return false;return true;}else return !obj;
to be a one-liner simply because it was crammed into one line.