Describe the functionality of the two forEach loops provided in the code snippet below. Also, is 'col' a predefined property for arrays?
var width = data.length, height = data[0].length;
data.forEach(function(col){
col.forEach(function(val){
geometry.vertices.push(new THREE.Vector3(val.x,val.y,val.z))
colors.push(getColor(2.5,0,val.z));
});
});
In case you need to reference the initial code:
var data = new Array();
for(var x=BIGIN;x<END;x++){
var row = [];
for(var y=BIGIN;y<END;y++){
z = 2.5*(Math.cos(Math.sqrt(x*x+y*y))+1);
row.push({x: x, y: y, z: z});
}
data.push(row);
}