将代码tableDatadata = name m1 groupName group1 type Messense_Mutation name m1 groupName group2 type Messense_Mutation name m1 grou
<script>
const tableData = {
data: [
{
name: "m1",
groupName: 'group1',
type: 'Messense_Mutation'
},
{
name: "m1",
groupName: 'group2',
type: 'Messense_Mutation'
},
{
name: "m1",
groupName: 'group3',
type: 'Messense_Mutation'
},
{
name: "m1",
groupName: 'group7',
type: 'Messense_Mutation'
},
{
name: "m1",
groupName: 'group4',
type: 'Multi_Hit'
},
{
name: "m2",
groupName: 'group1',
type: 'Frame_Shit_del'
},
{
name: "m2",
groupName: 'group2',
type: 'Splite_Site'
},
{
name: "m2",
groupName: 'group3',
type: 'Nonsense_Mutation'
},
{
name: "m2",
groupName: 'group4',
type: 'Frame_Shit_del'
},
{
name: "m5",
groupName: 'group4',
type: 'Splite_Site'
},
{
name: "m9",
groupName: 'group4',
type: 'Nonsense_Mutation'
}
]
};
const typeCounts = {};
tableData.data.forEach((item) => {
if (!typeCounts[item.type]) {
typeCounts[item.type] = 1;
} else {
typeCounts[item.type]++;
}
});
const uniqueTypes = Object.keys(typeCounts);
console.log('Unique types:', uniqueTypes);
console.log('Type counts:', typeCounts);
</script>
原文地址: https://www.cveoy.top/t/topic/bp7H 著作权归作者所有。请勿转载和采集!