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
class Queue { | |
constructor() { | |
this.items = []; | |
} | |
enqueue(data) { | |
this.items.push(data); | |
} | |
dequeue() { |
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
class Stack { | |
constructor() { | |
this.items = []; | |
} | |
push(element) { | |
this.items.push(element); | |
} | |
pop() { |
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
// LINKEDLIST NODE | |
class Node { | |
constructor(data){ | |
this.data = data; | |
this.next = null; | |
} | |
} | |
// LINKEDLIST IMPLEMENTATION | |
class LinkedList { |
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
function promissDemo(){ | |
new Promise(function(resolve, reject){ | |
setTimeout(function(){ | |
console.log('200'); | |
resolve() | |
}, 200); | |
}).then(function(fromResolve){ | |
setTimeout(function(){ | |
console.log('100'); | |
//resolve('hello') |
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
function Circle(radius) { | |
this.radius = radius; | |
this.draw = function() { | |
console.log(this.radius); | |
} | |
} | |
function Rectangle(radius) { | |
Circle.call(this, radius); | |
} |