Skip to content

Instantly share code, notes, and snippets.

@adrianvlupu adrianvlupu/if.js
Last active Mar 31, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.