sort()
reduce()
function solution(A, B) { A.sort((a, b) => a - b); B.sort((a, b) => b - a); return A.reduce((result, a, i) => result + a * B[i], 0); }