main.js 557 B

1234567891011121314151617
  1. const input_range_min = document.querySelector("#input-range-min");
  2. const input_range_max = document.querySelector("#input-range-max");
  3. const output = document.querySelector("#output");
  4. const btn_submit = document.querySelector("#btn-submit");
  5. function get_random(min, max)
  6. {
  7. return Math.floor(Math.random() * (max - min)) + min;
  8. }
  9. btn_submit.addEventListener("click", (event) => {
  10. const min = input_range_min.value;
  11. const max = input_range_max.value;
  12. const result = get_random(min, max);
  13. output.textContent = `Result: ${result}`;
  14. });