Another way would be to open terminal ctrl+` execute node
. Now you have a node REPL active. You can now send your file or selected text to terminal. In order to do that open VSCode command pallete (F1 or ctrl+shift+p) and execute >run selected text in active terminal
or >run active file in active terminal
.
If you need a clean REPL before executing your code you will have to restart the node REPL. This is done when in the Terminal with the node REPL ctrl+c ctrl+c
to exit it and typing node
to start new.
You could probably key bind the command pallete commands to whatever key you wish.
PS: node
should be installed and in your path