code not working for bigger range of numbers

So my problem is that I wrote this code that takes two numbers and writes all numbers between those numbers (including the given two numbers). The code works for the numbers 4 and 7, it prints out "4 5 6 7" but when the 2nd number is a little bigger than the first number for example for the numbers 6 and 14 the code does nothing. If someone could explain to me why it is like this and how could I solve this problem I would-be so happy.

function calculate() {
  var start = document.getElementById("number1").value;
  var end = document.getElementById("number2").value;
  var answer = "";
  for (var i = start; i <= end; i++) {
    answer = answer + i + " ";
  }
  document.getElementById("answer2").innerHTML = answer;
}
<input type="number" id="number1">
<input type="number" id="number2">
<button onclick="calculate()">Pokaż</button>
<div id="answer2"></div>

117 thoughts on “code not working for bigger range of numbers”

  1. pharmacie en ligne kinshasa therapie comportementale et cognitive obesite , pharmacie leclerc evreux traitement lombalgie , Lisinopril prix sans ordonnance, Acheter Lisinopril 10 mg pas cher. Lisinopril sans ordonnance Suisse Lisinopril pas cher [url=https://suissevsper.asso-web.com/#]Lisinopril livraison Suisse[/url] therapie act exercices Premarin pharmacie Suisse, Acheter Premarin comprimГ© pas cher. Premarin pharmacie Suisse Premarin pas cher [url=https://reserve12sor.asso-web.com/#]Premarin pharmacie Suisse, Premarin prix sans ordonnance[/url] , pharmacie zillisheim pharmacie de garde marseille 1er , pharmacie lafayette chartres. pharmacie de garde wattrelos Metformine sans ordonnance Belgique, Metformine livraison Belgique. Metformine sans ordonnance Belgique Metformine pas cher [url=https://santetopfeu.asso-web.com/#]Metformine Glucophage 1000[/url] , pharmacie de garde marseille apres 20h therapie de couple rembourse, act therapy nhs therapies meaning . therapie act toulouse, traitement uv hypnose & therapies breves – guignard s. troyes treatments with alternatives .

    Reply

Leave a Comment