In this program merged two array and then sorted using temp.but this not correct method.because two array are sorted ,so method should be unique i.e. merging of two sorted i
can do with es6 spread operator
let a=[1,2,3,5,9] let b=[4,6,7,8] let newArray=[...a,...b].sort() console.log(newArray)