JSFiddle - React, Tailwind, and code Playground
by StormMan
JavaScript
function pairWithGivenDifference (list, diff) {
for(let x of list) {
for (let y of list) {
if ((x - y) == diff)
return [x,y];
}
}
}
console.log(pairWithGivenDifference([100, 2, 5, 6, 80], 78));