JSFiddle - React, Tailwind, and code Playground

by Brenton Strine

JavaScript

console.clear();

function unless(args){
console.log("unless")
    var i = 0;
    while(args[i++]()===false){}
}

var myApp = function(){
  var user = "john";
  unless([isPaul, isBrad, isJohn, isGeorge, function(){
    console.log("User is not on the bad list.");
  }]);

  function isPaul(){
    if(user=="paul"){
      return true;
    }
    console.log('user isnt paul');
    return false;
  }
  function isBrad(){
    if(user=="brad"){
      return true;
    } else {
      return false;
    }
  }
  function isJohn(){
    if(user=="john"){
      console.log("oh no, user is John!!")
      return true;
    } else {
      return false;
    }
  }
  function isGeorge(){
    if(user=="george"){
      return true;
    } else {
      return false;
    }
  }
}
myApp();