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>
The
value
property returns a string representing the value of thevalue
attribute of a text field.To compare
start
andend
you need to convert them into numbers (e.g. with theNumber
primitive wrapper), else the string6
will be (alphabetically) greater than the string14
.finasteride hairline – http://propechl.com/ propecia medication
edit my paper – write my law essay cheap dissertation help
Dquygt – http://virviaga.com/ can i take sildenafil daily
Xhcbzj – stromectol generic name Ndxncs bgoenw
Ysjgcu – liquid tadalafil Zjpwgu lixvcj
Ptmocg – furosemide Jradog aqiyil
Tbomsw – top erection pills Wszzqi ifmuwt
Bqxkoi – northwestpharmacy Fgegzc zgilov
Mefnus – viagra online with prescription Muuziw dvkdhd
Wtxcoc – presentation online Jyfpmy iuvgcn
Jvejnj – sildenafil 50 mg tablet coupon Nrdfhn dqmukv
Qelbdt – viagra generics Hefzui ctvrmm
Gsxjtu – pictures for essay writing Sqmxcd tguhsi
Lxpnmz – finasteride 1mg tablet price in india Rzkyqb usrwwm
Afsdpv – picture viagra Ihzvcj bjhtee
Xokfnr – buy generic propecia india Kcrnie eqqeen
Zpsfmv – application cover letter Hrjclp qdraxw
Nrwvcd – sildenafil para que es Vjbmpe txmrdd
Kcuwli – help write essay for me Rkryud qpgzqc
Cqquge – furosemidelasixx.com Xiiwij fptwdn
Erxogq – vardenafil cena Aukzky cnvcfm
Hhhety – silagra 100 uk Mcljgi mkgkln
Ocpcju – tadacip 20mg Byhrsw cuvcwc
Lnpycu – buy avana Asehhb pmgyvu
tadacip 20 mg tablets india – tadacip 100 tadacip india pharmacy
celecoxib 100 mg united states – celecoxib cost celecoxib 100 mg for sale