This code leads to :Uncaught error : check is not defined.Can some one help regarding this code snippet. Please find below code
The check() is define in external .js file
Method in script tag ...
    <script>
    loadScriptfinal("/js/VendorPaymentInfo/"+coreId+".js", function() {
                             check();
                            });
    function loadJS(file,callback) {
        var jsElm = document.createElement("script");
        jsElm.type = "application/javascript";
        jsElm.src = file;
        jsElm.onload = function() {
            callback(); 
        }
        // finally insert the element to the body element in order to load the script
        document.body.appendChild(jsElm);
    }
    </script>
 
    