I have a javascript in which I try to read a file and just print it on the console , however it gives "File is not defined" error inspite of the file test.txt being in the same path Following is the code snippet.
var txtFile = "test.txt";
var file = new File(txtFile);
file.open("r");
var str = "";
while (!file.eof) {
str += file.readln() + "\n";
}
console.log(str);
file.close();
new File(txtFile)but there is nothing that defines what File is.