JSFiddle - React, Tailwind, and code Playground

Used in answer for http://stackoverflow.com/questions/27977904/access-inner-function-variable-outside-javascript-function

by UselessCode

HTML

<div id="turnaround" style="cursor: pointer;">
turn around click
</div>

JavaScript

var testData = "LoadedVariable",
    loadFunction = function () {
        testData = "DynamicVariable";
    },
    clickHandler = function () {
      loadFunction();
      alert(testData);
    },
    turnaround = document.getElementById('turnaround');

turnaround.addEventListener('click', clickHandler, false);