Somewhat related: check out gl-matrix for some fast matrix math in JavaScript - https://github.com/toji/gl-matrix
On the other hand, optimal speed and JavaScript are often different ball parks.
I threw together this thing for when I need some matrix stuff in a little script. Not fast, but flexible.
var vop = op=>( (a,b)=>( a.map((v,i)=>op(v,b[i])) ) );
var vdiff = vop((a,b)=>a-b);
var vadd = vop((a,b)=>a+b);
var vdot= (a,b)=>a.reduce( (ac,av,i)=>ac+=av*b[i],0);
var vlength = a=>Math.sqrt(vdot(a,a));
var vscale = (a,b)=>a.map(v=>v*b);
var vdistance = (a,b)=>vlength(vdiff(a,b));
var vnormalised = (a,b=1)=>vscale(a,b/vlength(a));
var project = (point, matrix) => matrix.map( p=>vdot(p,[...point,1]));
var transpose = matrix=> ( matrix.reduce(($, row) => row.map((_, i) => [...($[i] || []), row[i]]), []) );
var multiply = (a,b,...rest)=>(!b)?a:multiply(a.map( (p=>transpose(b).map(q=>vdot(p,q)))),...rest);
I look forward to the day when the sufficiently-smart JIT implements the optimal Matrix Multiplication from that. :-)