Stroring the max candy + 1
let mxcandy = candy [ 0 ] ; for ( let i = 0 ; i < candy . length ; i ++ ) { if ( mxcandy < candy [ i ] ) { mxcandy = candy [ i ] ; } } let fr1 = new Array ( mxage + 1 ) ; fr1 . fill ( 0 ) ; let fr2 = new Array ( mxcandy + 1 ) ; fr2 . fill ( 0 ) ;