JSFiddle - React, Tailwind, and code Playground

by manchagnu

JavaScript

function sayHi() {
    return "HI";
}


function throwHi() {
    throw new Error("HI");
}


// Give it to me sync
setTimeout(function() {
    console.log(sayHi());
}, 1000);


// Throw it to me sync
try {
    setTimeout(function() {
        console.log(throwHi());
    }, 2000);
}
catch( ex ) {
    console.log("Exception caught", ex.message);
}