Now for each component find the maximum shortest distance and store it in result
let result = [ ] ; let numOfComp = components . length ; let maxDistance ; for ( let i = 0 ; i < numOfComp ; i ++ ) { maxDistance = maxInThisComponent ( components [ i ] , graph ) ; result . push ( maxDistance ) ; } return result ; }