Skip to content

Instantly share code, notes, and snippets.

@johnnyferreiradev
Last active April 1, 2019 19:37
Show Gist options
  • Select an option

  • Save johnnyferreiradev/cd1a320eb659b0774b95827a2e790ff9 to your computer and use it in GitHub Desktop.

Select an option

Save johnnyferreiradev/cd1a320eb659b0774b95827a2e790ff9 to your computer and use it in GitHub Desktop.
Algoritmo de Fila implementado em uma classe ES6 ou superior
function Fila(list) {
this.list = list
this.add = elem => {
this.list.push(elem)
return this.list
}
this.remove = () => {
this.list.shift()
return this.list
}
this.isEmpty = () => {
const status = this.list.length == 0 ? true : false
return status
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment