In the body tag you have written to print outside function global count A. And in the output there are two sentences printed. If it is correct pls explain how the output comes like that.
Variables declared without a declaration keyword ( such as 'var', 'let' or 'const') are always global even if declared within a function. There is no wrong in declaring the count variable without mentioning 'var'. It is another way of declaring a global variable.
The example which you have given about global variable is not explained. You are not explaining the output, like first 2 sentence of the program output how it is getting printed , how the value is printed. All that. Its confusing. Pls explain it if you can.