JSFiddle - React, Tailwind, and code Playground

by jsumners

JavaScript

(function() {
    var msg = "This is a test.";
    
    function a() {
        console.log("Running first setTimeout.");
        alert(typeof msg);
    }
    
    function b() {
        console.log("Running second setTimeout.");
        alert(typeof msg);
    }
    
    setTimeout(a, 3000); // "string"
    setTimeout("b()", 5000); // ReferenceError b is not defined
})();