setw ( ) is used for fill the blank right is used for right justification of data
let x = result . length ; let digits = String ( result [ x - 1 ] ) . length ; for ( let i = 0 ; i < x ; i ++ ) { result [ i ] = new Array ( x - i ) . fill ( " " ) . join ( " " ) + result [ i ] ; document . write ( String ( result [ i ] ) + " " ) ; } }