Besides the options listed in the answers above; these are additional options I use when I need to write/test JS without HTML/CSS :
1) Firefox Developer Edition - ScratchPad
The Firefox Developer Edition browser offers a good console with all the necessary features to write JavaScript.
To cite a specific feature - ScratchPad provides you with a good option to write JS code and you can use the run button to view it on the console.
As you can see below it has the syntax coloring and even the options to save and open files directly from your computer.
You can open the Firefox ScratchPad as an independent window using the shortcut - SHIFT+F4
It features code completion, inline documentation and much more, you can learn more about using it from the official documentation here - https://developer.mozilla.org/en-US/docs/Tools/Scratchpad
Keyboard Shortcuts
CTRL + L - To display selected code
CTRL + SPACE - Code Hinting
CTRL + R - Run Command
CTRL + I - Inspect Command
2) Node CMD or CMD + Node
I also like using node + CMD since they work seamlessly. For this option, you need to install node.js and use the CMD to write and test your JS code.
You can also consider using the node.js CMD that works like the windows CMD.
You can change the background color and the text color of the Node CMD by clicking on the top bar and choosing properties
For syntax coloring on Node when using node, you can add one of the syntax coloring npm packages as illustrated below :
I installed the cli-color npm package in these four steps :
1) Check if npm is installed using the nmp -v
2) Install your preferred package using npm install <name of package>
3) Include the package
4) Test the package and view the results
NOTE: It important to check out the documentation of each package esp on the usage since there may be differences.
These are two of my favorite Node.js syntax highlighting packages :
https://www.npmjs.com/package/cli-color and https://www.npmjs.com/package/cli-highlight