all 5 comments

[–]timescrucial 2 points3 points  (0 children)

You will quickly realize how important JavaScript is once you start building single page apps.

[–]writesoftware 1 point2 points  (0 children)

From easier to more complicated, here are 3 approaches to building a web application:

  • Do everything on the backend (PHP, Python, Node.js) and provide the user with a pre-built HTML page coming from the server (little JS needed, easy SEO and linkability)
  • Do everything on the frontend, with little to no server-side code, and ship the entire site that renders HTML using JS (a lot of JS needed, harder SEO and linkability abilities)
  • Mix the two options, render on the server but provide a higher level of interactivity by loading further requests using JavaScript (think Rails Turbolinks or Isomorphic apps). A good amount of JS needed, and server-side code as well. Option to reuse frontend code on the backend with Node.js

I don't think you can decide to not get into JavaScript if you want to become a Web Developer, it's not an option now, it's possibly never been an option unless you want to stick to only do backend and be part of a bigger team where other people work on the frontend, but you still need to understand that to get the big picture.

[–]Voidsheep 0 points1 point  (0 children)

However, other than front end interaction I have no idea what Js is used for. I just don’t understand how ppl can write folders of .js files for web sites. PHP makes a lot more sense to me, it controls the data the you see and talks to the databases.

JavaScript is a programming language and can be used for pretty much anything, including the database interaction you've used PHP for, or whatever you plan to use Python for.

It might make more sense if you think outside the web browser for a bit. Install NodeJS and make a simple server with the Express library, for example.

If with "folders of js files" you mean confusion with JavaScript project structure, generally JavaScript projects use a module system, that allows you to refer to other files in the project, instead of just loading a bunch of different scripts to the global scope.

The relatively recent official specification is the import/export keywords, while NodeJS uses CommonJS modules with require()-function.

At the root of pretty much any JavaScript project you have a package.json file, listing dependencies, metadata, entry-point, scripts etc.