JSFiddle - React, Tailwind, and code Playground

by cristighenea

HTML

<p>working code for this:</p>
<img width="200" src="https://scontent-b-fra.xx.fbcdn.net/hphotos-xap1/v/t1.0-9/10509699_10152526210426840_5035077420345415761_n.jpg?oh=ff7c86011300df3eb35199bff394299d&oe=54535722"/>
<div id="output">
</div>

JavaScript

function beAwesome(){	
	console.log('awesomeness starting now!');
}


var count = 0;

function sad(){

	var isSad = true;
	if (count === 0) {
		count++;
		console.log('things are sad...');
		return isSad;
	} else {
		var obj = {
			stop: function(){
				console.log('sadness stopped!');
			}
		}
		return {
			stop: function(){ console.log('sadness stopped!');}
		}
	}

	

}

if (sad() === true){
	sad().stop();
	beAwesome();
}