Solved Electronics Shop Algorithm with JavaScript from HackerRank

I’m just trying to solve all of them by using JavaScript.
If you want to read the detail of Electronics Shop challenge, please visit HackerRank website.
Here is the explanation for my JavaScript solution:
function getMoneySpent(keyboards, drives, s){
// Complete this function
let max = -1;
// I'm trying to get the total number of keyboard and drive
// then compare to the money.
for(let i = 0; i < keyboards.length; i++){
var temp = 0;
for(let j = 0; j < drives.length; j++){
if(keyboards[i] + drives[j] <= s){
temp = keyboards[i] + drives[j];
max = temp > max ? temp : max;
}
}
}
return max;
}
You can visit my git repository for more JavaScript solution, or if you can improve it, please leave a comment :)