2

I am reading a book (JavaScript:The Definitive Guide) related to JavaScript, and it had three sections as

"Client-Side JavaScript",
"Server-side JavaScript"
"CoreJavaScript"

It fails to explain the difference or I could not find it. Can someone please explain the below:

Are they differ in anything other than the usage ? or Does the syntax and definitions also differ?

Also as discussing about the book, I started learning JavaScript with this book ( JavaScript:The Definitive Guide), Next I will move on to 'JavaScript:The Good Parts by Douglas, and then I will try to inspect code of some real websites. Please let me know if I am going in right path to master this language?

Pradeep
  • 1,057
  • 2
  • 9
  • 17
  • It had three distinct sections, but it failed to explain the difference? Did you actually read all the sections? What's the book? – xdumaine Jun 23 '14 at 12:36
  • JavaScript:TheDEfintive guide, Currently I am in 'Core JavaScript' section. My aim in reading this book to gain knowledge in JavaScript useful for developing website? – Pradeep Jun 23 '14 at 12:38
  • I think the terms `Server-Side`, `Client-Side` and `Core` are misleading. There is one language specification for JavaScript that is ECMAScript, it defines all language elements the need to be provided by the JS engine. Depending where you use JavaScript (Browser, a server environment like nodejs or to script an application) it may have varios additions that are specific to the environment. – t.niese Jun 23 '14 at 12:44
  • My outdated copy of that book opens the Core JavaScript section with *"This part of the book...documents the core JavaScript language and is meant to be a JavaScript language reference."* which I'll grant is a bit vague. It opens the Client-side JavaScript section with this sentence: *"This part of the book...documents JavaScript as it is implemented in web browsers."* which I'd say is fairly clear. (I've had my copy over a decade, it doesn't have the server-side part at all. Which is amusing as JavaScript *started out* on the server...) – T.J. Crowder Jun 23 '14 at 12:45
  • @Pradeep_Evol: Yeah, I figured. That's why I said mine was outdated. :-) – T.J. Crowder Jun 23 '14 at 13:54
  • Related post - [what is client side javascript and what is server side javascript?](https://stackoverflow.com/q/1404376/465053) – RBT Jun 25 '19 at 04:56

4 Answers4

7

Are they differ in anything other than the usage ? or Does the syntax and definitions also differ?

The language is the same. The environment is different.

By "Core JavaScript," Flanagan is talking about the language and only the objects and functions defined by the ECMAScript specification, leaving anything provided by the environment out.

By "Client-side JavaScript" he's talking about the use of JavaScript, the language, in a browser environemnt. In a browser environment, your code will have access to things provided by the browser, like the document object for the current page, the window, functions like alert that pop up a message, etc.

By "Server-side JavaScript" he's talking about the use of JavaScript, the language, in a server environment. In that environment, your code won't have access to browser-related things because, well, it's not in a browser. It'll probably have access to other things, like APIs for dealing with the file system, databases, network, etc.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
3
  • Server-sided: Runs on server (like Node.js)
  • Client-sided: Runs in browser
  • Core: The set of functionality available to all javascript engines
Anders Bornholm
  • 1,326
  • 7
  • 18
0

Without knowing the book, I can't tell you what is the meaning of CoreJavaScript, but in what concerns to the first two the difference is:

Client side javascript as the name says, is javascript code, running on the client side, a typical scenario of this is, when you access a website, and you run javascript code. The code being executed is being executed on the clients machine. This is why it's called client side javascript.

About the second, server side javascript, is javascript code running over a server local resources, it's just like C# or Java, but the syntax is based on JavaScript, a good example of this is Node.JS, with Node.JS you write javascript to program on the server side, and that code can be seen as normal C#, C, or any other server side language code.

With server-side code, you can still send javascript to the client-side, but there is a great diference between both, because the client side code is restricted to the clients machine resources, in terms of computing power and permissions. For example client-side javascript can't access the clients hard disk, while with server side you can access your server hard disk without any problem.

UPDATE

I've read a bit of the book, and Core JavaScript is about the JavaScript language per se (JavaScript Reference), i.e, the syntax, the statements, the function definitions, it's the basics of the language in general.

Imagine you are reading about C# or Java, before writing about Sockets Programming, WebServices, etc, the book is giving the reader an insight of the language first, in terms of it's capabilities, ways to create functions, arrays, and so forth.

devunder
  • 126
  • 8
João Pinho
  • 3,725
  • 1
  • 19
  • 29
0

after installation of node js in system then we use javascript on server side. the code of nodejs is just like a javascript. no major differences so its also a javascript. Nodejs enables the user to use javascript code on server side too.

Pradeep
  • 9,667
  • 13
  • 27
  • 34