Example of using a while loop to generate a list of numbers
// jshint esversion: 7
//while loop examples: return list of numbers 1 .. n
function countUp(n){
let i = 1, numList = "";
//generate numbers 1 .. n
while(i <= n){
numList = numList + i + " ";
i++;
}
return numList;
}
function countUp_with_backtick(n){
let i = 1, numList = "";
//generate numbers 1 .. n
while(i <= n){
numList = `${numList}${i} `;
i++;
}
return numList;
}