CRX RemoveLast, i else part can we use this code

Ma’am in else part can we use this(Remove last) :-

this.tail = getNodeAt(this.size-2);
this.tail.next = null;
this.size–;

here tail is saving the value of node