Seeking guidance as a beginner in JavaScript. I need help with finding the best approach to solve this problem: I have two integers, a and b, where a < b. I want to print all integers in the range [a;b] inclusive. The pattern should be such that integer a is printed 1 time, a+1 is printed 2 times, and so on. Any advice would be appreciated. Thank you! Update: Here is my current approach:
"use strict";
console.log("Task 6");
var a = Number(prompt("Enter a"));
var b = Number(prompt("Enter b"));
if(a>b){
var c = b;
b = a;
a = c;
}
for(var i = a; i <= b; i++){
for(var j = 1; j <= i; j++){
console.log(i);
}
}