add isEmpty function to check whether an array is empty or not