How to run JavaScript using jsc on OS X?

后端 未结 3 1489
天命终不由人
天命终不由人 2021-01-30 10:46

I got this when I was trying to find some way to run my JavaScript programs through terminal. The run and load command mentioned can execute external J

3条回答
  •  花落未央
    2021-01-30 11:49

    You're not very clear on what sort of programs these scripts are. Do they do local tasks (e.g. interact with the local file system)? Or are they web scripts that are supposed to interact with (HT|X)ML documents?

    If your usage scenario is the former, I recommend using node.js. It is under heavy development, but it is already very usable. For my first project with Node I wrote an XMPP chat bot, completely in JavaScript.

    Edit:

    I seem to have overlooked "using jsc" in the question and answered "How to run JavaScript on OS X?" instead. Still, I think Node is a better alternative if the author is looking to use JavaScript in place of something like Python or Perl.

提交回复
热议问题