Why doesnt this work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesnt this work?

I'm trying to make it give an alert if you clicked within the given x and y but it desn't work, why? c.addEventListener('click', function(evt){ if( evt.X > headX && evt.X < headX += headW && evt.Y > headY && evt.Y < headY += headH ) alert('You clicked it'); });

9th Dec 2019, 12:42 AM
Lemonades For Sale
Lemonades For Sale - avatar
2 Answers
0
Why += Why not just + Like "headX + headW"
9th Dec 2019, 8:37 PM
Mystic Life
Mystic Life - avatar
0
Yea I figured it out a little while ago but thanks
9th Dec 2019, 11:12 PM
Lemonades For Sale
Lemonades For Sale - avatar