How do you run JavaScript script through the Terminal?

前端 未结 16 1785
离开以前
离开以前 2020-12-02 04:00

For instance, if you were to run a Python script you would type python filename.py or if you wanted to run a C program make filename then ./ filename

16条回答
  •  借酒劲吻你
    2020-12-02 04:25

    All the answers above are great, I see one thing missing and could be considered for running javascripts(*.js) files, the unrelated brother of javascript the Java.

    JDK comes up with two nice tools, could be utilized for executing javascripts. Here are command goes like. Make sure to navigate to JDK\bin.

     jjs example.js
    

    Its comes up with another commmand tool that goes like this-

     jrunscript example.js
    

    I hope this may be helpful to others.

提交回复
热议问题