Get multiple minimal number from array
If I understand your question correctly, you're trying to:


Get n smallest numbers from your array.
The original array doesn't get mutated.


First off:


Underscores have a special meaning in programming. They're used to denote pseudo-private variables. Since JS has no concept of private (unless emulated with closures), prefixing an underscore to a publicly accessible variable means not to access that variable directly.
For this operation, you don't need jQuery. Vanilla JS has it's own forEach for $.each and filter for $.grep.
Just so you know, $ and jQuery are the same. The $ is an alias made for convenience. jQuery is the global of jQuery to prevent issue with clobbering. IIRC, MooTools uses the $ global. Anyone can alias their library as $, but who names their library "jQuery" besides jQuery?
$(document).ready(fn) can be shortened to $(fn) or jQuery(fn).
This operation is best moved out to a function so that you can call this out, pass in an array, and get the results you want.
Another problem is that $.grep return a new array every call. That means on each iteration of $.each, you're creating a new array - which is bad.
Math.min in your code will always return the smallest number. This means on every push, the numbers run from smallest to largest. Why not sort the array first and slice the first n?


Running with the above assumptions and review, you can do this:



function getSmallestNumbers(array, n) {
  // We slice first to prevent mutation of the original array when we
  // do `sort`. Then we slice again to get n items.
  return array.slice().sort().slice(0, n);
}

var distances = [4, 3, 1, 2];
var nearDistances = getSmallestNumbers(distances, 3);

// SE should seriously have a console view
document.write(JSON.stringify(nearDistances));