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