Here is the code to display pyramid but its not exactly producing required output.
This could be done using a single for loop.
var num = ""; var size = prompt("Enter the size of the pyramid"); for(var i=1; i<=size; i++) { num = num + i console.log(num); }