Question: uncaught referenceerror arr is not defined?
Answer: In technical terms it mean to say that you have not defined “arr” as variable . Now your error got solved. The conclusion is you have to be careful when accessing a variable and it is better to check whether it is defined as global or not.