I want to use function with while to print only 10 numbers starting from the number I choose.
But while loop doesn't stop looping.
id = prompt('Write any number.');
function numbering(a) {
var i = a;
var j = a + 10;
while (i < j) {
document.write(i);
i++;
}
};
numbering(id);
document.writewithinsertAdjacentHTML().a = +a;. The unary operator (+) will cast the variableato a number, since prompts actually returnsstrings, so using + on strings will result in concatenating.