Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //JavaScript FIFO
- function Fila(){
- this.lista = new Array();
- this.Inserir = function(obj){
- //Inserir no fim da fila um elemento
- this.lista[this.lista.length] = obj;
- }
- this.Remover = function() {
- //Remove o primeiro elemento
- if(this.lista.length>0){
- this.lista.splice(0,1);
- }else{
- alert("Não há objetos na Fila");
- }
- }
- this.Escrever = function(){
- elem = this.lista.length;
- document.write("<b>Escrevendo FIFO</b></br>");
- if(elem>0){
- cont = 0;
- for(cont=0;cont<elem;cont++){
- document.write(
- this.lista[cont]+"<br>");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement