title: Shorten code of JQUERY UI Slider with specific values
body: <pre><code>var values = [50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000, 550000, 600000, 650000, 700000, 750000, 800000, 850000, 900000, 950000, 1000000, 1100000, 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000, 3300000, 3400000, 3500000, 3600000, 3700000, 3800000, 3900000, 4000000, 4100000, 4200000, 4300000, 4400000, 4500000, 4600000, 4700000, 4800000, 4900000, 5000000, 5100000, 5200000, 5300000, 5400000, 5500000, 5600000, 5700000, 5800000, 5900000, 6000000, 6100000, 6200000, 6300000, 6400000, 6500000, 6600000, 6700000, 6800000, 6900000, 7000000, 7100000, 7200000, 7300000, 7400000, 7500000, 7600000, 7700000, 7800000, 7900000, 8000000, 8100000, 8200000, 8300000, 8400000, 8500000, 8600000, 8700000, 8800000, 8900000, 9000000, 9100000, 9200000, 9300000, 9400000, 9500000, 9600000, 9700000, 9800000, 9900000, 10000000];
  var slider = $("#slider-range-price").slider({
      orientation: 'horizontal',
      range: true,
      step: .0001,
      min: 50000,
      max: 10000000,
      animate: "slow",
      values: [0, 10000000],
      slide: function(event, ui) {
          var includeLeft = event.keyCode != $.ui.keyCode.RIGHT;
          var includeRight = event.keyCode != $.ui.keyCode.LEFT;
          var value = findNearest(includeLeft, includeRight, ui.value);
          if (ui.value == ui.values[0]) {
              slider.slider('values', 0, value);
          } else {
              slider.slider('values', 1, value);
          }
          // $("#price-amount").html();
          var min = kFormatter(slider.slider('values', 0));
          var max = kFormatter(slider.slider('values', 1));
  
          $('input[name="input_20"]').val('$' + min + ' - $' + max);
          $("#slider-range-price span:nth-child(2)").html("&lt;div class='min-price-sales'&gt;" + min + "&lt;/div&gt;");
          $("#slider-range-price span:nth-child(3)").html("&lt;div class='min-price-sales'&gt;" + max + "&lt;/div&gt;");
          return false;
      }
  
  });
  </code></pre>
  
  <p>I have the code above, its a JUQERY UI slider with specific values, its all working. But as you can see the <code>values</code> which is up to <code>10,000,000</code>with following intervals is too long. Is it possible to shorten this?</p>