Below is the code I tried to write data into the file using JavaScript:
var f = "sometextfile.txt";
writeTextFile(f, "Spoon")
writeTextFile(f, "Cheese monkey")
writeTextFile(f, "Onion")
function writeTextFile(afilename, output)
{
var txtFile =new File(afilename);
txtFile.writeln(output);
txtFile.close();
}
It just prints the output to the console, not to a file. Can anyone tell me how to write data to file only using JS?