I'm not sure why i can't add a comment, but anyway i realise that you didn't declare the count with a 'const' or 'var' keyword, could that be a problem?