Fill the complete array with 0
for ( let i = 0 ; i < MAX_SIZE ; i ++ ) { nodeCharactersCount [ i ] = new Array ( MAX_CHAR ) ; for ( let j = 0 ; j < MAX_CHAR ; j ++ ) { nodeCharactersCount [ i ] [ j ] = 0 ; } } for ( let i = 0 ; i < MAX_SIZE ; i ++ ) { tree [ i ] = [ ] ; }