This with arrow functions

This with arrow functions
0

#1

I have the following code for a linked list.

function LinkedList(head = null, tail= null) {
  this.head = head;
  this.tail = tail;
}

function ListNode(val, next=null, previous=null) {
  this.val = val;
  this.next = next;
  this.previous = previous;
}


LinkedList.prototype.unshift = function(node) {
  node.next = this.head;
  this.head = node;
  
}

const LL = new LinkedList();
const firstNode = new ListNode(100);
LL.unshift(firstNode);

I want to be able to define unsift() like this

LinkedList.prototype.unshift = (node) =>{
  node.next = this.head;
  this.head = node;
  
}

Only because I’m using the arrow function the this keyword doesn’t exist. So how would I do it? I suspect with bind and /or apply but I’m not clear on how exactly. (Note I’m not saying it’s better to do with the arrow function, in fact, I suspect it’s not, but I’d like to be able to if I wanted to)