JSFiddle - React, Tailwind, and code Playground

by dhoerster

HTML

<div id='results'></div>

JavaScript

/*

*/

var x = 3, x1 = "3",
    y = "hello", y1,
    z = false, z1,
    zero = 0;

var agileWays = agileWays || {};
agileWays.sayHi = function() { alert("hi"); };
agileWays.sayHi();
agileWays["sayHi"]();

var funcName = "sayHi";
agileWays[funcName]();
return;

var myObj = new Object();
myObj["myName"] = "Dave";
myObj["myJob"] = "Common Sense Evangelist";
alert(myObj["myName"] + " is a " + myObj["myJob"]);
alert(myObj.myName + " is a " + myObj.myJob);
return;

y1 = +x1;
alert(typeof y1);
alert(y1 === 3);

z1 = !!zero;
alert(z1);
alert(z1 === false);
alert(zero === false);

return;

alert(0==false);
alert(""==false);
alert(undefined==false);
alert(1==true);
alert(NaN==NaN);
alert(undefined==null);

return;

alert(typeof x);
alert(typeof y);
alert(typeof z);

alert(typeof null);
alert(typeof undefined);
alert(typeof NaN);

return false;

alert(x == "3");    //truthy
alert(x === "3");   //false!
alert(x === +"3");  //true!
    
alert(z == 0);           //truthy
alert(z == "0");         //truthy
alert(z === "false");    //false
alert(z === !!"false");  //false
alert(z === !!zero);     //true!



/*

var nullObject = null,
    undefObject = undefined,
    emptyObject = {};

if(nullObject){ alert('huh?'); } else { alert('it is null'); }
if(undefObject){ alert('huh?'); } else { alert('it is undef'); }
if(emptyObject){ alert('why here...it is empty'); } else { alert('it is empty'); }

*/

/*
var Agile = Agile || {};
Agile.Ways = {};
Agile.Ways.fun = "fun";
Agile.Ways.fun1 = function() { alert('fun1 is ' + Agile.Ways.fun + '!'); };
Agile.Ways["fun2"] = function() { alert('fun2 is also ' + Agile.Ways.fun + '!'); };
                   
Agile.Ways.fun1();
Agile.Ways.fun2();

Agile.Ways2 = {
    fun: "fun",
    fun1: function() { alert('new fun1 is ' + Agile.Ways2.fun + '!'); },
    fun2: function() { alert('new fun2 is also ' + Agile.Ways2.fun + '!'); }
};
Agile.Ways2.fun1();
Agile.Ways2.fun2();


var comma = (y=3, z=9);
alert(comma);

*/

/*

var Agile = Agile || {},
   ...