JavaScript Tome el primer elemento de matriz
const array = [1,2,3,4,5];
const firstElement = array.shift();
// array -> [2,3,4,5]
// firstElement -> 1
Nice Nightingale
const array = [1,2,3,4,5];
const firstElement = array.shift();
// array -> [2,3,4,5]
// firstElement -> 1
var first = "role";
data.sort(function(x,y){ return x == first ? -1 : y == first ? 1 : 0; });