The difference is simply where the JS code runs.
Both the browser and Node.js implement the ECMAScript standard, which defines the Javascript language. Standard Javascript built-ins like Date and String are defined in this standard, along with language semantics. Since both the browser and Node.js implement the standard, code that only uses built-in objects should run on both environments.
Where they differ is the other APIs each environment provides. The browser implements the Web API, which includes built-in objects like the document object. Node.js defines its own set of built-in's like require and Buffer . Node.js does not implement the Web API, so any code that makes use of the document object could not run. You'd get a reference error when execution reaches the part of the code that references document, although your code will be parsed and execution will start. Similarly, when run on a browser, code that makes use of Node.js built-in's will throw a reference error when it encounters the name it cannot resolve.
In practical terms, this means that front-end and Node.js serve different purposes. The purpose of the front-end is to interact with the user, so the code for the front-end needs to manipulate the page and other client-side things, and so the browser implements the Web API, which provides this functionality. Contrast this to the purpose of the server, which is to serve the front-end, interact with the database, and other server-y things, so Node provides API's that support those things. Therefore, most code is either written to run on Node.js or the browser. You also have libraries that essentially make parts of the API for one environment available in the other, allowing code to be more platform independent. Isomorphic Javascript is the buzzword for this idea.
So basically, Node.js and the browser are two separate platforms for different purposes. Both are Javascript runtimes, but have different API's above that.
Here's an article explaining what Node.js is: medium.com/@nishantagrwal/what-exactly-is-node-js…