I got stuck on Ball Upwards challenge on codewars.
I think that I don’t understand the problem properly. I need some explanation to understand the problem. Also I need tips to help me solve the challenge.
My Code so far:
function maxBall(v0) {
let v = Math.round((v0 * 1000) / 3600);
let g = 9.81;
let t1 = v / 10;
let t2 = ((v / 10) * 10 + 1) / 10;
let h1 = v * t1 - 0.5 * g * t1 * t1;
let h2 = v * t2 - 0.5 * g * t2 * t2;
let result1 = ((t1 * 10) / 10) * 10;
let result2 = ((t2 * 10) / 10) * 10;
console.log(res1, res2, h1, h2);
return h2 < h1 ? result1 : result2;
}
The link to the challenge: