Valeur maximale de carte javascript
let m = new Map([['a', 2], ['b',4], ['c',6]])
console.log("Max:", Math.max(...m.values()))
Run code snippet
Anxious Alpaca
let m = new Map([['a', 2], ['b',4], ['c',6]])
console.log("Max:", Math.max(...m.values()))
Run code snippet
let m = new Map([['a', 2], ['b',4], ['c',6]])
console.log([...m.entries()].reduce((a, e ) => e[1] > a[1] ? e : a))
Run code snippet