xxxxxxxxxx
sumOfNodes(LL) {
// contact me !!!
// linkedIn account : https://www.linkedin.com/in/mohammad-alshraideh-67820b186/
if (!this.head) return 0;
let sum = 0;
let current = this.head;
while (current) {
if (typeof current.value == "number") {
sum = sum + current.value;
}
current = current.next;
}
return sum;
}
//if you find the answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)