JSFiddle - React, Tailwind, and code Playground

by Deepak Anand

HTML

<div id = "console"></div>

CSS

#console {
  white-space:pre;
  font-family: monospace;
}

JavaScript

var consoleElt = document.getElementById("console")
function log (val){
  var newLine = '\n'
  consoleElt.textContent = `${consoleElt.textContent} \n ${val}`
}

//------------//------------//------------//------------//------------//------------//
/*
(function(){
	try{
  	foo()
		bar()
  }catch(e){
   log(e)
  }
  
  function foo(){
   log('hello world')
  }
  
  var bar = function(){
    log('hi')
  }
}())


(function(){

		log(typeof canFly === "undefined")
    
    log(typeof isDeadly === "undefined")
        
    var canFly = function(){ 
    	return true
    }
    window.isDeadly = function(){
    	return true
    }

}())
*/

(function(){

	var util = {
  	helloString: 'hello',
  	hello: function(){
    	return this.helloString;
    }
  }
  
  var helloAlias = util.hello;
  
  log(util.hello())
  
  log(helloAlias())
  
  log(helloAlias.call(util))

}())

/*(function(){
	function yell(n){
  	return n > 0 ? yell(n-1) + "a" : "hiy"; 
	}
  log(yell(4))
}())*/