I have a number from minus 1000 to plus 1000 and I have an array with numbers in it. Like this:
[2, 42, 82, 122, 162, 202, 242, 282, 322, 362]
I want that the number I’ve got changes to the nearest number of the array.
For example I get 80
as number I want it to get 82
.