<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
function solution(m, product){
let answer=0;
n=product.length;
product.sort((a, b)=>(a[0]+a[1])-(b[0]+b[1]));
// console.log(product);
for(let i=0; i<n; i++){
let money=m
}
return answer;
}
let arr = [[6,6], [2,2], [4,3], [4,5], [10,3]];
console.log(solution(28, arr));
</script>
</body>
</html>
이 코드에서 product.sort((a, b)=>(a[0]+a[1])-(b[0]+b[1])); 가 잘 이해되지 않습니다. (a[0]+a[1])-(b[0]+b[1])빼주면 왜 sort함수에 의해 정렬이 되는지 궁금합니다.