node -e 'console.log(1+1)'

Category: Node.js & npm/yarn

node -e 'console.log(1+1)'

Evaluate a JavaScript expression from the command line

Evaluates a JavaScript expression directly from the command line without a file.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.