且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在OS X上使用jsc运行JavaScript?

更新时间:2021-08-27 02:22:46

这篇文章的补充,JSC居住在

/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc

,默认情况下不在外壳PATH中.您可以使用

and is not in the shell PATH by default. You can fix that with

ln -s /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /usr/local/bin

jsc将文件名作为参数.您可以使用

jsc takes filenames as arguments. You could run a file named demo.js with

jsc demo.js

请注意,您必须在脚本中使用debug()而不是常规的console.log()来查看任何输出.

Note that you'll have to use debug() instead of the conventional console.log() in your script to see any output.