When I use numbers in the example below, I get the correct return/output.
var array = [1,2,4,5,];
divBy2 = v => v / 2;
var result = array.map(divBy2);
When I try this below, I get NaV.
var array = [output];
divBy2 = v => v / 2;
var result = array.map(divBy2);
My code is written as below. Basically, I'm loading a text file with the following line:
Numbers (999.000,999.000),(999.000,999.000),
Then I want to create an array and take those numbers and divide by 2. To return just the numbers without the entire string.
var reader = new FileReader();
function readText(that){
if(that.files && that.files[0]){
var reader = new FileReader();
reader.onload = function (e) {
var output=e.target.result;
output=output.split("\n").filter(/./.test,/Numbers/).join("\n").replace(/[^0-9.,]/g,'');
var array = [output];
divBy2 = v => v / 2;
var result = array.map(divBy2);
document.getElementById('inputTextToSave').innerHTML= output;