0
我有一系列项目matchingItemsCurrentRow
。它有IBwFormSectionItem
其中有一个属性runCount
项目。我想获得具有最大值runCount
的数组项目。我怎么才能得到它?如何获得阵列项目中具有最大属性值的阵列项目
的IBwFormSectionItem
的类型定义如下:
export interface IBwFormSectionItem {
meta?: IBwFormItemMetadata[],
font?: IBwFormFont,
col?: number,
row?: number,
colSpan?: number,
rowSpan?: number,
text?: string,
runs?: boolean,
runCount?: number,
height?: number,
width?: number
}
请发布您使用JSON格式的数据以及预期的输出。 – Bergi
此问题已被询问和回答多次。大多数解决方案都使用'reduce'来遍历项目。 –
没有得到笏你试图做。如果你想从数组中获得最大值尝试这个代码... Math.max.apply(this,[1,2,3,4]); – subbu