What do you mean by not working? What doesn’t it do that you expect it to? Have you tried outputting to the console log at various parts of your script to see what’s happening?
Edit: Have you checked the console to see if there are any errors?
well for starters &bnsp doesnt mean anything to a browser. You’re trying to type " " (for Non-Breaking SPace).
the second thing is that an element does not have a getImageData attribute. If you’re trying to get the image data from a canvas’s context, you need to get the context first, and then call the getImageData function on that context.
the third thing is that even when you do get the image data from a context, it is not an array to be accessed, it contains an attribute, .data, which holds the image data in an array of size 4*number-of-pixels.