pingu,
шифровка из центра...
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 = [1.58, 0.1, 0.06, 0.06, 0.05, 0.05, 0.05, 0.05, 0.01];
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;
}, [])
}
console.log(arrIndex(arr1, arr2))