JSFiddle - React, Tailwind, and code Playground

by josh3736

JavaScript

$(function() {
    var scopeVar = "I'm in scope!";
    setTimeout(function() {
        alert(scopeVar);
    }, 1);
    
    setTimeout(annoy, 2);
    
    function annoy() {
        alert(scopeVar + ' ...still');
    }
    
    setTimeout('alert(scopeVar);', 3); // This will execute in global scope and throws an error.
});