I have a usecase wherein I am reading streaming data from server, and putting it into an array. So my approach is:
var points = str.split("n"); //split input based on new line character
var positions = new Float32Array();
for (let i = 0; i < points.length; i++) {
var coords = points[i].split("_"); //split line into individual values separated by '_'
for(let j=0; j < coords.length; j++) {
var coord = parseFloat(coords[j]) // parse string to float
positions.push(coord); // add to float array
}
}
But this is not working. code execution just stops at ‘push’, and nothing happens after that.
Is Float32Array not correct data structure for this usecase?