Skip to content

Instantly share code, notes, and snippets.

View rshivkumar95's full-sized avatar

Shivkumar Rathod rshivkumar95

View GitHub Profile
@rshivkumar95
rshivkumar95 / queue-es6.js
Last active July 21, 2019 14:00
Queue Implementation using ES6
class Queue {
constructor() {
this.items = [];
}
enqueue(data) {
this.items.push(data);
}
dequeue() {
@rshivkumar95
rshivkumar95 / stack-es6.js
Last active July 21, 2019 13:44
Stack Implementation using ES6
class Stack {
constructor() {
this.items = [];
}
push(element) {
this.items.push(element);
}
pop() {
@rshivkumar95
rshivkumar95 / linkedlist-es6.js
Last active July 21, 2019 13:16
Linked List Implementation
// LINKEDLIST NODE
class Node {
constructor(data){
this.data = data;
this.next = null;
}
}
// LINKEDLIST IMPLEMENTATION
class LinkedList {
function promissDemo(){
new Promise(function(resolve, reject){
setTimeout(function(){
console.log('200');
resolve()
}, 200);
}).then(function(fromResolve){
setTimeout(function(){
console.log('100');
//resolve('hello')
@rshivkumar95
rshivkumar95 / newKeywordWithConstructorFunction.js
Last active July 4, 2019 07:29
'new' keyword with constructor function
function Circle(radius) {
this.radius = radius;
this.draw = function() {
console.log(this.radius);
}
}
function Rectangle(radius) {
Circle.call(this, radius);
}