用文本编辑器,如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