i implement simple matrix multiplication in javascript for
var multipliction = function(matrixa,matrixb){ var result = []; (var = 0;i < matrixa.length;i++){ result.push(new array()); (var j = 0;j < matrixb.length;j++) result[i].push(0); } (var = 0;i < matrixa.length;i++) (var j = 0;j < matrixa[i].length ;j++) for(var k = 0;k < matrixb[j].length;k++) result[i][j] += matrixa[i][k] * matrixb[k][j]; return result; };
but think runs async ,so if part takes long execute,it jump next , result is't trusted, what's way sure above code run synchronously ?
Comments
Post a Comment