為什么用node運行后報錯了(黑色背景那張圖片)?我把代碼放在谷歌瀏覽器調試工具那里運行卻能輸出正確結果?
function learn(something){
console.log(something);
}
function we(callback,something){
something += ' is cool';
callback(something);
}
we(learn, 'Nodejs')
SyntaxError: Unexpected identifier
? ? at Object.exports.createScript (vm.js:24:10)
? ? at REPLServer.defaultEval (repl.js:235:25)
? ? at bound (domain.js:287:14)
? ? at REPLServer.runBound [as eval] (domain.js:300:12)
? ? at REPLServer.<anonymous> (repl.js:431:12)
? ? at emitOne (events.js:82:20)
? ? at REPLServer.emit (events.js:169:7)
? ? at REPLServer.Interface._onLine (readline.js:211:10)
? ? at REPLServer.Interface._line (readline.js:550:8)
? ? at REPLServer.Interface._ttyWrite (readline.js:827:14)
2016-07-09
代碼沒有問題,只是你執行有問題。直接運行node callback.js。即可??茨愕慕貓D是進入了node的命令行下。
2016-08-10
創建的文件放在哪個文件位置???