//数据结构对比 增查改删 { //map、set和Object let item = {t:1}; let map = new Map(); let set = new Set(); let obj = {}; //增 map.set('t',1); set.add(item); obj['t'] = 1; console.info('map-set-obj',map,set,obj);//{"t" => 1};0:value:{t: 1};{t:1}; //查 console.info({ map_exist:map.has('t'), set_exist:set.has(item), obj_exist:"t" in obj })//true true true //改 map.set('t',2); item.t = 2; obj['t'] = 2; console.info('map-set-obj-modify',obj,map,set);//{t: 2};{"t"=>2};0:value:{t: 2} //删 map.delete('t'); set.delete(item); delete obj['t']; console.info('map-set-obj-empty',obj,map,set);//{};{};{} }