javascript check if string exists and is not empty