DEV Community

loading...

Explain Node.js like I'm five.

realabbas profile image Ali Abbas ・1 min read

Explaination of what Node.js and V8 is all about?

Discussion

pic
Editor guide
Collapse
deciduously profile image
Ben Lovy

Gotta go in reverse order for these!

V8 is a program that understands JavaScript. When you write a source code file, that's human readable. It's got specific syntax, but it's still designed to be read and edited by humans. To get a computer to do what you want, you need to feed your JS into some sort of program that understands our language and knows how to talk to a computer. That's what V8 does, it translates your JS into instructions that a computer process can understand, like your web browser.

Generally, a web browser is where you'll find tools like V8, where it makes web pages interactive. However, it's also useful to be able to run JavaScript programs without a browser. Node.js is a program that embeds V8 in a standalone way, outside of a web browser. This means your computer can understand and run JavaScript on its own. A web server is just a computer somewhere, so Node allows you to write a web server in JS as well as a client application. This way your whole project gets to speak the exact same language. On the server, Node is processing your JS for the computer, and on a client, any code you serve up is interpreted by V8 in your browser ( if you use chrome).

Collapse
alansolitar profile image
Alan Solitar

Good overview. I'll also just add a few interesting bits of info.

  • v8 is written in mainly in c++.
  • It's actually extensible, meaning you can write your own addons for v8 in c++.
Collapse
keith_greer profile image
Keith Greer

Great explanation Ben. I have struggled to understand the use for node until now.

Duly followed.

Collapse
realabbas profile image
Ali Abbas Author

Great Thanks Mate