function siblings(o){//Parameter o is who you want to take For sibling nodes, pass that element in
var a=[]; //Define an array to store the sibling elements of o
var p=o.previousSibling;
while(p){/ /First take the brothers of o to determine whether there is a previous brother element. If there is, proceed to p to represent previousSibling
if(p.nodeType===1){
a.push(p);
}
p=p.previousSibling//Finally assign the previous node to p
}
a.reverse()//Reverse the order so that the order of the elements is sequential
var n=o.nextSibling;//Get o’s younger brother
while(n){//Determine whether there is a next younger brother. Node n means nextSibling
if(n.nodeType===1) {
a.push(n);
}
n=n.nextSibling;
}
return a//Finally, put this group of elements in order from oldest to youngest Return
}