Driver code
let arr = [ 12 , 10 , 5 , 6 , 52 , 36 ] ; let n = arr . length ; let position = 2 ; SplitAndAdd ( arr , n , position ) ; for ( let i = 0 ; i < n ; ++ i ) document . write ( arr [ i ] + " " ) ;