Skip to content

Instantly share code, notes, and snippets.

@adrianvlupu
Last active March 31, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianvlupu/6f6378955bef5077b2a2 to your computer and use it in GitHub Desktop.
Save adrianvlupu/6f6378955bef5077b2a2 to your computer and use it in GitHub Desktop.
if js joke
/*
************ Noul If ************
ofera multiple avantaje vs nativul if.
1. EstePascalCase
2. Are(callbackuri) la fel ca d3. Genial!
3. Accepta multiple Then/Else pentru a se mula pe orice proiect.
4. Colegii il vor adopta imediat !
Flexibil! Dinamic! Util! Deloc Ironic!
*/
window.If = function(b){
var o = {};
o.Then = function(c){if(b){ c(); } return o;};
o.Else = function(c){if(!b){ c(); } return o;};
return o;
}
//use case
If(window).Then(function(){
console.log('Primul Then');
}).Else(function(){
console.log('Primul Else');
}).Then(function(){
console.log('Al 2lea Then');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment