跳到主要内容
CNode

console.log可以输出中文吗?

社区
Ccncenxi发布于 14 年前最后回复 14 年前
354770

console.log("中文"); 命令窗口中什么都不显示

查看回复

回复 (3)

J
jiyinyiyong#314 年前
引用 cncenxi<pre var http = require("http"); function start(route) { function onRequest(request, response) {...

你不会是直接用 node 执行上面的文件了吧, 这只是个模块定义啊 需要在别的模块 require 了然后运行才会打印的

C
cncenxi#214 年前
var http = require("http");
function start(route) {
  function onRequest(request, response) {
    response.writeHead(200, {"Content-Type": "text/plain"});
    response.write("Hello World");
    response.end();
  }
  http.createServer(onRequest).listen(8003);
  console.log("启动成功了");
}
exports.start = start;

如上面的代码,环境 winxp + nodejs 0.6.0.7
J
jiyinyiyong#114 年前

在哪里输入, 具体环境是什么?

参与回复

登录后即可参与回复。登录