I know next to nothing about JavaScript. I’ve done a couple of very basic tutorials that allow me to identify variables, constants, and functions, but I cannot parse statements and understand them yet. And that’s just the language itself. Then, there are front-end and back-end scripts (both in js).
Frontend scripts are either written directly in one’s html or are linked to where they are kept within the collection of html / css / and javascript files that compose one’s website. (NOTE: I plan to stick with .js for both frontend and backend code to avoid having to involve myself in PHP.) Frontend scripts are exposed to DevTools and must be kept free of sensitive information.
Backend scripts, OTOH, can contain sensitive information (like MySQL login credentials, etc.) and must not be exposed to DevTools. This means that they must be kept separate from html, css, and frontend scripts which are at the root level for my website. Backend scripts must not be included at the root level.
How do I distinguish between frontend and backend scripts? Where do I store backend scripts? When I deploy my code from the DEV environment (where I write and change code) to my localhost environment (where I test code) and thence to where I host my website (https://url), what files do I have to include? For example, I can use my FTP client (Filezilla) to upload all the files I have in my top level folder for my website. (By that I mean that I have a directory tree that has folders for html, css, images, styles, and scripts that contain all the files that allow me to display the website, but not process any user input. I can point Filezilla to that folder and it will upload all the files needed.)
There’s also the run-time environment that has to be available to run JavaScript. I know nothing meaningful about this subject. I’ve learned that I need a .env file that contains information that allows access to MySQL when javascript runs and needs to read or write a data table.
As you can tell by my questions that I need to learn a great deal more about javascript. My order of attack is to try to understand the run-time environment as a prerequisite to writing backend code.
So, am I right to try to get a handle on the environment first? If not, why not?
Finally, what sources do you recommend for learning about the run-time environment for .js? The books I have focus almost exclusively on coding in .js with little attention given to teaching about the environment.
TIA

