js有没有像php那样的exit直接退出函数的函数?

JavaScript016

js有没有像php那样的exit直接退出函数的函数?,第1张

有,在js中用于中断程序继续运行的3种方法: break continue return

break和continue一般用于循环,进行打断

return是返回结果值,如果为了中断程序

一般通过 return false 去中止程序的继续运行

推出node命令行:两次ctrl+C或者一次ctrl+D 退出终端:exit(经测试,都没什么问题) 快捷键是ctrl+d或者输入.exit,在node下输入.help你会看到一个命令清单,里边介绍了常用命令。 希望我的回答对你有帮助。

ActiveXObject是IE的东西, 你在node里要用child_process, 例如

var

spawn = require('child_process').spawn,

call = spawn('cmd.exe', ['/c','echo','echo something'])

call.stdout.on('data', function(Q){console.log(Q.toString())})

call.stderr.on('data', function(Q){console.log('error',Q.toString())})

call.on('exit', function(Code){console.log('Exited',Code)})