get console log in file code example
Example 1: how to get output of console.log in a file in javascript
node script-file.js > log-file.txt
Example 2: how to get output of console.log in a file in javascript
node script-file.js >log-file.txt 2>error-file.txt