Javascript Loop trouble

I am calling the function below. The log that I am receiving when I input the number 7. The log shows the values 71, 8, 9, 10, 11. I am assuming it has something to do with treating i as a string and then a number. To combat it I tried the Number() method. Same Log with and without the Number() method

function hideCoasterQuantity(number) {
  for (var i = number; i < 11; i++) {
    var hideVal = Number(i + 1);
    $("#coasteremblem-" + hideVal).hide();
    console.log("hide coaster " + hideVal);
    $("#coasteremblemtitle-" + hideVal).hide();
  }
  console.log("hideCoasterQuantity completed");
}

Answer

Make sure the caller of hideCoasterQuantity calls it with a number, eg:

hideCoasterQuantity(Number(someInputValue));

That’ll fix the problem and let you remove the numeric casting inside hideCoasterQuantity:

var hideVal = i + 1;

But adding 1 to the index inside the loop is strange, why not just start from i + 1 to start with?

function hideCoasterQuantity(number){
  for(let hideVal = number + 1; hideVal < 12; hideVal++) {
    $("#coasteremblem-" + hideVal).hide();
    $("#coasteremblemtitle-" + hideVal).hide();
  }
}