3 ms·
// since typing it out like this is preferable to reteaching myself LaTeX right now let favoriteEquation = arr => { let total = 0; for(let x of arr
by jbpetersen 10y ago
// since typing it out like this is preferable to reteaching myself LaTeX right now
let favoriteEquation = arr => {
let total = 0;
for(let x of arr)
total += Math.abs(x);
let normalizedArr = [];
for(let x of arr)
normalizedArr.push(Math.abs(x/total));
return normalizedArr;
};