For loop offsetting


#1


Hey guys I was practicing for loops and came to a dead end.

\\This is to display the numbers between the users inputs.

var input1 = prompt("Start number?");
var input2 = prompt("end number?");


for(var i =input1; i < input2; i++) {
  console.log(i);
};


if I enter input1 = 1, input2 = 10.
I get from 1 - 9. 

How do I get till 10? 
Anyway to offset it without the user having to do it? 
And how do I not show "" in the console?

Thanks for the response.


#2

try replace < with <= . This will make it so it loops when its less than or equal to, so it still loops at 10, but over 10 it doesn't. And I'm not sure if its possible to not show "" in the console, cause I think that's something to do with codecademy itself (not for certain though)


#3

Thank you Russell '<=' fixed it...


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.