can you please help me solve this problem in JavaScript with explanation.
There are two arrays of integer arr1 and arr2 one move is defined as an increment or decrement of one element in an array. Determine the minimum number of moves to match arr1 with arr2.
Input: nums1 = [1,2,3,4,5,6], nums2 = [1,1,2,2,2,2] Output: 3
Explanation: You can make the sums of nums1 and nums2 equal with 3 operations. All indices are 0-indexed.