Javascript – Track mouse position

The mouse’s position is reported on the event object received by a handler for the mousemove event, which you can attach to the window (the event bubbles): (Note that the body of that if will only run on old IE.) Example of the above in action – it draws dots as you drag your mouse over the page. (Tested on IE8, IE11, … Read more

Cannot read property ‘forEach’ of undefined

There is no semicolon at the end of the first line. So the two lines run together, and it is interpreted as setting the value of funcs to The expression 1, 2 becomes just 2 (comma operator), so you’re trying to access index 2 of an empty array: And undefined has no forEach method. To fix this, always make sure you put a semicolon at … Read more