I want to make parsed var array object from a local file in functionA
my law file is like below in locations.txt
-33.890542, 151.274856
-33.923036, 151.259052
-34.028249, 151.157507
-33.80010128657071, 151.28747820854187
-33.950198, 151.259302
I want to make like below parsed var array object
var locations = [
[-33.890542, 151.274856],
[-33.923036, 151.259052],
[-34.028249, 151.157507],
[-33.80010128657071, 151.28747820854187],
[-33.950198, 151.259302]
];
function openTextFile() {
var input = document.createElement("input");
input.type = "file";
input.accept = "text/plain";
input.onchange = function (event) {
processFile(event.target.files[0]);
};
input.click(); } function processFile(file) {
var reader = new FileReader();
reader.onload = function () {
//1) What should I do in here?
//var parseResult = parse(reader.result); //I don't know about parse part.
};
reader.readAsText(file, /* optional */ "euc-kr");
}
function initMap(parseResult) { //do something... }
I want to make like below parsed var array object via "parse function"
var locations = [
[-33.890542, 151.274856],
[-33.923036, 151.259052],
[-34.028249, 151.157507],
[-33.80010128657071, 151.28747820854187],
[-33.950198, 151.259302]
];