Vlasenko Fedor,
как вариант
let arr1 = [1.58, 0.12, 0.1, 0.06, 0.06, 0.06, 0.05, 0.05, 0.05, 0.05, 0.05, 0.01];
let arr2 = [0.05, 0.1, 0.06, 0.06, 0.05, 0.05, 0.05, 0.01, 1.58];
function arrIndex(a, b) {
let ob = {};
return b.reduce((ar, el) => {
let k = ob[el] ??= 0;
k = a.indexOf(el, k);
ar.push(k);
ob[el] = ++k;
return ar;
}, [])
}
const res = arr2.map(v => this[v] = arr1.indexOf(v, (this[v] ?? -1) + 1));
console.log(res);
console.log(arrIndex(arr1, arr2));
но использовать this ??? всё валится в window