What I want is very simple, to run code while typing, just like enter node and run things like this:
% node
Welcome to Node.js v17.0.1.
Type ".help" for more information.
> var a=5; var b=6;
> console.log(a+b);
11
But in this case, I have to copy and paste my code again and again.
Is it possible to "include" the code from an eternal .js file, then let me stay in the console-like environment to run the code?
Store these in the app.js:
var a=5;
var b=6;
function addNumber(x,y){console.log(x+y);}
In node console:
% node
Welcome to Node.js v17.0.1.
Type ".help" for more information.
> include "app.js" //- This is what I'm looking for
> addNumber(a,b);
11