JSFiddle - React, Tailwind, and code Playground
HTML
<div id='out'>
</div>
JavaScript
const a = { x: 0, y: 0}
const b = { x: 3, y: 3}
function pathNr(A, B) {
if (A.x === B.x) {
return 0
}
if (A.x === B.x && A.y === B.y) {
return 1;
}
return pathNr({A.x, A.y + 1}, B) + pathNr({A.x + 1, A.y}, B)
}
document.getElementById('out').innerHTML = pathNr(a, b)