This Forg Jump Codility challenge in lesson 3 is just a simple practice task.
A O(1) one-line solution is easy to reach:
function solution(X, Y, D) {
return (Math.ceil((Y-X)/D))
}
See the result here: https://app.codility.com/demo/results/trainingB6VKUQ-UST/