Nice job putting your request.js script tag and the main.js script tag in index.html in the right order so that the backendCall function can be accessed from main.js:
If you're going to be adding multiple scripts to html files in future projects, you should look into using ES6 modules. When you turn a script tag into an ES6 module by adding type=module to it, you prevent the variables from that file from being added to the global scope:
Nice job putting your
request.js
script tag and themain.js
script tag inindex.html
in the right order so that the backendCall function can be accessed frommain.js
:If you're going to be adding multiple scripts to html files in future projects, you should look into using ES6 modules. When you turn a script tag into an ES6 module by adding
type=module
to it, you prevent the variables from that file from being added to the global scope:You'd access the backendCall variable in main.js files by exporting it from request.js:
and then importing it at the top of main.js: