var arr = ['1','2','3','4']; var amount_to_remove = 2; arr.splice(arr.length - amount_to_remove, amount_to_remove); //['3', '4']
arr.splice(arr.length - 2, 1);
var pg_url = array_fragment[array_fragment.length - 2]