JavaScript – Understanding Front End vs Back End JavaScript

front-endjavascriptnode.js

I've been noticing lately, as I've played around with javascript, HTML5, and node.js for the first times that javascript seems to be a language that is used very differently (and with different syntax) depending on where it is used at. My observation with javascript is this:

-Front end javascript finds the JS embedded in HTML5 pages, where it is used to build dynamic webpages and react to events that occur on the page.

-Back end JS is used as a solo language with node.js and its associated packages to handle web page requests, data transfers, and general server tasks.

Have I accurately summarized front end versus back end JS?

Best Answer

That's a good summary.

Note that if you're front-loading functionality into your browser page, there may be little difference between your front-end and back-end javascript. For example, I worked on an app that did pathfinding through maps of airports. I did it in javascript in the browers to keep it fast & save a round trip. My code to do the graph traversal didn't make any reference to the browser or events, so it could have run on either front end or back end. I just put it on the front end to speed things up.

That's an addendum to your summary, though, rather than a contradiction.