This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |