JSFiddle - React, Tailwind, and code Playground

HTML

<div id="res">Result:</div>

JavaScript

function myFunc() {
    var local1 = 'local1',
        local2 = 'local2',
        local3 = 'local3';
        local4 = 'local4',
        local5 = 'local5';
    
    return 'Hello, World';
}

var res = document.getElementById('res');
res.innerHTML += myFunc() + '<br>';
res.innerHTML += window.local3 + ' - should be undefined<br>';
res.innerHTML += window.local4 + ' - should be undefined but oops<br>';
res.innerHTML += window.local5 + ' - should be undefined but oops<br>';