How to find the most suitable number for a given number.
For example. I have a number 8 and an array of objects.
let num = 8;
let data = [
{ fist: {a: 1, b: 2}, second: {c: 11, d: 12}, number: 1 },
{ fist: {a: 3, b: 4}, second: {c: 13, d: 14}, number: 7 },
{ fist: {a: 5, b: 6}, second: {c: 15, d: 16}, number: 10 },
];
The closest number of all numbers in each object is 7. How can I display the whole obit to which the number 7 belongs?