Your code seams massively over complex.
I do not see the need to sort the arrays as the overhead does not warrant the the benefit.
Assigning to the maps in the sort function is very inefficient. The sort function will be called many more times than there are items in the array.
I would say that if (hashMapB.hasOwnProperty(difference)) { is redundant as it can be assumed that object within the environment of leetcode will not have enumerable properties higher in the prototype chain to worry about. Thus if (hashMapB[difference] !== undefined) or would be more performant.
The long variable names makes your code hard to follow. Consider short names and use common abbreviations to reduce the length of lines.
JS will automatically insert semicolons, but there are many situations where to location of the insertion is not obvious. Inexperienced JS coders should always use semicolons. Experienced coders know its easier to include them.
You don't need to delimit single line statement blocks with {} however it is a source of future bugs when modifying code, as adding the {} can easily be overlooked and very hard to spot. Always delimit all statement blocks. eg if (foo) bar =1 is better as if (foo) { bar = 1 }
The link you provided is not a suitable problem, rather just a discussion topic. I have nothing to test on apart from the limited arguments provided in the discussion. As there are many question that the set of inputs does not answer writing the optimal solution is not possible. Rather the example below is just a brute force solution of complexity \$O(nm)\$ where \$n\$ and \$m\$ are the length of the two input arrays.
##Example
Comparing this function against yours and assuming that the values to sum are signed integers (not unsigned as that would allow the inner loop to be skipped if an items had a value greater than the sum (3rd arg)). It returns a result in 0.589µs against your functions 25.250µs (µs = 1/1,000,000 second)
I did not test it against very large data sets nor did I look too deeply for a less complex solution.
To avoid creating a new array each time a larger max sum is found I use a counter foundCount as an index to put new closer indexes. When the function is done I just trim the array by setting its length to the found count.
function currentHighest(a, b, max) {
const lenA = a.length, lenB = b.length, result = [];
var i = 0, j, foundCount = 0, maxFound = -Infinity;
while (i < lenA) {
j = 0;
const pA = a[i], valA = pA[1];
while (j < lenB) {
const pB = b[j], sum = valA + pB[1];
if (sum <= max && sum >= maxFound) {
if (sum !== maxFound) { foundCount = 0 }
maxFound = sum;
result[foundCount++] = [pA[0], pB[0]];
}
j++;
}
i++;
}
result.length = foundCount;
return result;
}