Open your Terminal and start the Node REPL with just typing Node. Anything you type in here, like two plus three, will be evaluated and print out. When you need to type multiple lines, switch over to editor mode. This will allow you to write as much stuff as you need.
So just sort a list here and then invoke it with two one three. Then hit control D to execute that. You'll see it prints out the sorted list. Then after, you'll still have this my sort in your context. So you can type my sort three one two and use that function however you want.
At any time, you can say save and a filename, hit enter. Then in your editor, you can open up that file, and it will have that entire session for you.
Or the opposite of that is to write your own file. I'll just write a function called add which takes an X and a Y and adds them together. Then I can say load app.js, and you can see it loaded the code from there. Now I can try out my add function. So add three and six, and we'll get nine. At any time, just type exit or .exit or control C to exit out of it.
You can also install Node packages. So we'll say install date functions. I find it's useful to require them in a script you're going to load. So I'll require date functions. I want to use a distance in words. Then I can fire up Node, tell it to load app.js. Now I can play with distance in words. We'll try today compared to, let's see, 2018, January 1st. You can see that's four months from now.
This will work with any project, large or small, a single script or a large project, where you can load in data and functions and play with them interactively...