Javascript function to transform string to add character upfront - 1 21 321 code example
Example: Javascript function to transform string to add character upfront - 1 21 321
function triangleNumber(num) {
if(num>15) return;
var str = '';
for(var i = num; i >= 1 ; i--) str += i;
console.log(str);
triangleNumber(num-1)
}
triangleNumber(1);