Difference between a repl (in the replit website), an npm and Node.js?

A REPL (Read Eval Print Loop) is a program (well, a programming environment) that you type an expression into and it prints the result. So console programs, ones you use via a terminal, they often work like this. For example, if you install Node and then type node (just that) into a terminal, the thing you installed includes a program called node which will open a REPL if you execute it on its own.

As an aside, the language which introduced repls allows you to do this against code that is running, ie you can rewrite the program while you run it: most other languages and environments that have a REPL do not allow this.

repl.it is just a website/app that lets you use different programming languages. You interact with them via a repl, that’s why it’s called replit.

JavaScript (or any programming language) needs something that takes the code and translates it into code the computer understands, into machine code. If you use JavaScript in a browser, the browser already includes that functionality. If you want to use JavaScript outside of a browser, you need something to translate it to machine code, to run the JavaScript you’ve written. Node does that.

Edit: to simplify, it’s the bit of Chrome that deals with JavaScript extracted into a seperate program so that you can run JS code without having a browser open.

You don’t really want to write every single piece of functionality yourself. Otherwise, for example, to complete these projects you’d need to write programs that tested your code. You just want to be able to use some library of code someone else wrote that has all the stuff you need to write tests.

There are lots and lots of libraries available. Node comes with a way to manage installing, uninstalling, updating etc those libraries, Node Package Manager, NPM. It is another program you get when you install Node: you type npm along with some commands specifying what you want to do into a console

2 Likes