中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
for .in 语法不支持
微信扫码分享
copyRecord(source: Record<string, string>): Record<string, string> { const target: Record<string, string> = {}; // 遍历源对象的属性 let sourceKeys = Object.keys(source) let targetKeys = Object.keys(target) for (let i = 0;i<sourceKeys.length;i++) { if (targetKeys.indexOf(sourceKeys[i])>=0) { // 复制到目标对象 target[sourceKeys[i]] = source[sourceKeys[i]]; } } return target; }