so I am working on a HarckerRank Challenge called "The Hurdle Race". I have two ways I completed the challenge in my IDE but it only passes two test cases when I put it in the IDE in HackerRank. When I take one of the case tests and put it in my own IDE I get the correct result. Am I missing something? Is my code incorrect? Below are my codes.

// 1st:
function hurdleRace(k, height) {
let maxH = Math.max.apply(null, k);
let iGotTheHops = 0;
console.log(maxH);
if (height < maxH) {
console.log(maxH - height);
return maxH - height;
} else {
console.log(0);
return iGotTheHops;
}
}
// 2nd:
function hurdleRace2(k, height) {
// Write your code here
let maxHight = k[0];
let iGotHops = 0;
for (let i = 0; i < k.length; i++) {
if (k[i] > maxHight) {
maxHight = k[i];
}
}
if (height < maxHight) {
console.log(maxHight - height);
return maxHight - height;
} else {
console.log(iGotHops);
return iGotHops;
}
}
hurdleRace([1,6,3,5,2],4)
hurdleRace2([1,6,3,5,2],4)
This is the test it flags as incorrect. States that my return is 0.