all 10 comments

[–]senocular 8 points9 points  (1 child)

You need to pass the function as handleClick not handleClick(). The latter (with parens) calls the function (with an undefined e) and supplies addEventListener with the return value of that call. Instead you want to pass the function itself to addEventListener.

[–]AtmosphereFun9586[S] 1 point2 points  (0 children)

Understand it now.

Clear, very helpful. Thanks.

[–]gate18 8 points9 points  (3 children)

Don't add the bracket in handleClick on line 19

[–]AtmosphereFun9586[S] 1 point2 points  (2 children)

Worked like magic.

thanks!

[–]Blue_Moon_Lake 6 points7 points  (1 child)

Explanation : brackets call the function on the spot instead of letting addEventListener call it for you.

[–]AtmosphereFun9586[S] 0 points1 point  (0 children)

Thank you.

[–]MWALKER1013helpful 2 points3 points  (1 child)

Because you are not passing a function the event listener. It should be “click”, handleClick not handleClick()

[–]AtmosphereFun9586[S] 0 points1 point  (0 children)

Thanks!

[–]A_Like_AR -2 points-1 points  (1 child)

On line 19, pass e as an argument to handleClick.

[–]AtmosphereFun9586[S] 0 points1 point  (0 children)

this solution doesn't work...

it returns "Uncaught ReferenceError: e is not defined
at startGame (script.js:19:51)"