js截取固定长度的对象
作者:互联网
js截取对象的方法,找了好多都不理想,自己写了一个记录一下
const langMap = resData.langMap const newData = {} let arr = [] for (const key in langMap) { arr.push(key) } arr.forEach((t, index) => { if (index < 16) { newData[t] = arr[t] } }) for (const key in langMap) { newData[key] = langMap[key] }
标签:index,arr,const,截取,js,langMap,key,长度,newData 来源: https://www.cnblogs.com/lb0121/p/16091175.html