一、代码块
var obj = {};
const handle0bj = key => {
if (obj[key] && obj[key].length> 0) {
obj[key].push(key);}
else {
obj[key]=[key];
}
}
handle0bj(1);
handle0bj(2);
console.log(obj); //调用两次的结果:{1:[1],2:[2]}
handle0bj(1);
handle0bj(2);
handle0bj(3);
console.log(obj); //调用三次的结果:{1:[1],2:[2],3:[3]}