Function to convert the number into binary and store the number into an array
function convertToBinary ( num , a , n ) { let pointer = n - 1 ; while ( num > 0 ) { a [ pointer ] = num % 2 ; num = parseInt ( num / 2 ) ; pointer -- ; } }