Hudson, Rick wrote:
In this case it is the same as with a normal array. function dotProduct(v1, v2) {return v1.map(function (e, i) {return e*v2[i];}).reduce(function (a, b) {return a+b;});}
So much nicer with ES6 arrow functions (now in SpiderMonkey):
function dotProduct(v1, v2) {
return v1.map((e, i) => e * v2[i]).reduce((a, b) => a + b);
}
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

