JavaScript 将数组中对象的 ID 属性转换为字符串
const list = [{"id": 5, "testStrategy": "机型差异化测试", "comment": "test5"}, {"id": 5, "testStrategy": "机型差异化测试", "comment": "test5"}]; const newList = list.map(item => { return { ...item, id: item.id.toString() }; });
console.log(newList);
原文地址: https://www.cveoy.top/t/topic/qdr4 著作权归作者所有。请勿转载和采集!