I have an array like this
var column = ["generic complaint", "epidemic complaint", "epidemic1 complaint", "epidemic2 complaint", "bal vivah", "name"]
I want the Last array element to be placed in first position , the sorted array should like this
var column = ["name","generic complaint", "epidemic complaint", "epidemic1 complaint", "epidemic2 complaint", "bal vivah"]
need the solution in typescript
It's quite easy:
let last = column.pop();
column.unshift(last);
Pop is used to remove the last variable but you can assign it. Unshift will add a new item at the start of an array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With