I'm trying to take an input from a text file (for example 3 7 9 53 2) and place those values into an array.
3 7 9 53 2
I tried with prompt(), but I obviously can only add them one by one:
for (var i = 0; i < n; i++) {
Array[i] = parseInt(prompt("Value for Array"));
}
However, I want to read line by line and add them to an array. A line will contain hundreds of numbers. is there a way to fill an array quickly by copying and pasting the data into the console? Like in java
String[] line = sc.nextLine().split(" ");