ES: map和set的用法

        let idSet = new Set();
        let starTimeMap = new Map();
        let endTimeMap = new Map();
        for(let i=0;i<resultList.length;i++){
            let locationInfo = resultList[i];
            let cardId = locationInfo.cardId;//
            let reportTime = locationInfo.reportTime;//上报时间

            idSet.add(cardId);
            if(!starTimeMap.has(cardId)){
                starTimeMap.set(cardId, reportTime);
            }
            endTimeMap.set(cardId, reportTime);
        }

猜你喜欢

转载自blog.csdn.net/amadeus_liu2/article/details/132834551