Check If List Is Empty Javascript Function