JSFiddle - React, Tailwind, and code Playground

JavaScript

var x = {foo: "g", bar: function() {alert("bar");}};

if (x.foo)
{
    alert("uh oh");
    x.foo();
    alert("if we don't see this, an exception was thrown");
}