iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 13
1
Modern Web

以前端角度探討遊戲化的資訊設計系列 第 13

Day 13 - queue

function Queue () { 
    collection = [];
    this.print = function() {
        console.log(collection);
    };
    this.enqueue = function(element) {
        collection.push(element);
    };
    this.dequeue = function() {
        return collection.shift(); 
    };
    this.front = function() {
        return collection[0];
    };
    this.size = function() {
        return collection.length; 
    };
    this.isEmpty = function() {
        return (collection.length === 0); 
    };
}


上一篇
Day 12 - 時間軸度的事件處理
系列文
以前端角度探討遊戲化的資訊設計13
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言