Skip to content

Instantly share code, notes, and snippets.

@wdiasvargas
Created May 4, 2017 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wdiasvargas/a659a9b36599c323fc3425a94072b4f8 to your computer and use it in GitHub Desktop.
Save wdiasvargas/a659a9b36599c323fc3425a94072b4f8 to your computer and use it in GitHub Desktop.
Nao entendo pq nao esta funcionando
/**
* Write by wdiasvargas on 04/05/17.
* www.williamdiasvargas.com.br
*
**/
'use strict'
//STACK com ES6
import push from './stack_methods/push'
import pop from './stack_methods/pop'
import peek from './stack_methods/peek'
import isEmpty from './stack_methods/isEmpty'
import clear from './stack_methods/clear'
import size from './stack_methods/size'
import print from './stack_methods/print'
class Stack {
constructor () {
this.data = [];
}
push = push;
pop = pop;
peek = peek;
isEmpty = isEmpty;
clear = clear;
size = size;
print = print;
}
let stack = new Stack();
console.log(stack.print())
// isEmpty.es6 export default () => this.data.length == 0;
// size.es6 export default () => this.data.length;
// push.es6 export default (element) => this.data.push(element)
// pop.es6 export default () => this.data.pop() || -1;
// peek.es6 export default () => this.data[this.data.length -1] || -1;
// clear.es6 export default() => this.data = [];
// print.es6 export default () => console.log(this.data.toString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment