Here is the code to display pyramid but its not exactly producing required output.
const pyramid = (n)=>{ const mid = Math.floor((2*n-1)/2); for(let row=0; row= col) level+='#'; else level +=' '; } console.log(level); } } pyramid(3);