javascript - Purpose of Function returns only boolean -


somewhere in jquery have seen 2 functions returns boolean below.

function h(){    return !0; }  function r(){    return !1;  } 

what purpose of doing this, while boolean can written directly?

economy of characters.

having 3 character function returns true or false takes less characters doing exact comparison.

var = false; if (a === r()) console.log('3 characters instead of 5') 

large libraries alias commonly used globals undefined , window minification.

for example, may see like

(function($, a, b) { ... })(jquery, window, undefined) 

Comments