Skip to content

Category: Questions

Why is there an error with onclick function?

I’m working on an assignment that asks us to use Promise, and when I run the script, I am getting this error on line 37: Uncaught TypeError: Cannot set property ‘onclick’ of null I can’t understand why the onclick is throwing this error, because I have used buttons before with similar …

TypeError: arr1.flat is not a function JavaScript

What’s wrong here? It’s saying array.flat is not a function. Answer Array.prototype.flat() is a relatively new feature, some environments such as Internet Explorer and Node.js < 11 will not support it. You can use a polyfill such as core.js or even setup a transpiler, such as babel, the differe…

Canvas Image not showing

I am currently having issues with displaying images in the HTML canvas. I am still new and I am quite tired so its likely theres somthing stupid I did not do. Heres the code: const canvas = …