Skip to content

Instantly share code, notes, and snippets.

View 11ma's full-sized avatar
👾

Michael A. 11ma

👾
View GitHub Profile
@11ma
11ma / linkedList.js
Created July 19, 2020 07:51
Linkedlist
// source https://codeburst.io/linked-lists-in-javascript-es6-code-part-1-6dd349c3dcc3
class Node{
constructor(data, next = null){
this.data = data,
this.next = next
}
}
class LinkedList{
constructor(){
call, apply, bind are methods functions have access to.
The bind() method makes a copy of the function attached to it. Whatever object you pass to it is what the "this" points to by reference.
The call() takes the object "this" will point to as a parameter. Unlike bind(), call() doesn't make a copy of the function, it executes the function.
The apply() also takes the object "this" will point to as a parameter, smiliar to the call, but it takes the rest of its values as an array.