用文本編輯器,如npp,鍵入如下代碼,存儲成hello.js
console.log('hello')
console.log('hello %s->%d','jeapedu', 1941847311)
console.log('hello')
console.log('hello %s->%d','jeapedu', 1941847311)
node hello.js
C:\nodeS>node hello.js
hello
hello jeapedu->1941847311
cmd進入dos,切入hello.js所在目錄,執行node.js程序
node hello.js
運行結果如下所示:
C:\nodeS>node hello.js
hello
hello jeapedu->1941847311