Javascript 如何编写接受参数的NectarJS程序?
好吧,问题就在标题里,所以我要做的就是给你举个例子,希望有人能帮上忙 注意:我使用的是Linux Mint 18.x 以下是我希望能够做到的:Javascript 如何编写接受参数的NectarJS程序?,javascript,linux,compilation,arguments,nectarjs,Javascript,Linux,Compilation,Arguments,Nectarjs,好吧,问题就在标题里,所以我要做的就是给你举个例子,希望有人能帮上忙 注意:我使用的是Linux Mint 18.x 以下是我希望能够做到的: #compile the javascrpit code with nectar nectar file.js --single -o compiledFile #now i want to run it with a second argument witch is an input file ./compiledFile inputFil
#compile the javascrpit code with nectar
nectar file.js --single -o compiledFile
#now i want to run it with a second argument witch is an input file
./compiledFile inputFile
我知道JavaScrpit本身不支持这种类型的编译,但是NectarJS库/编译器中是否有类似的东西您现在可以像Node一样使用process.argv(在nectar cli中指定--env Node,或者在std env中指定require(“进程”) 举个简单的例子:
for(var i = 0; i < process.argv.length; i++)
{
console.log(process.argv[i]);
}
for(变量i=0;i