Ask coding questions

← Back to all posts
Why does my JS not work?
bwoop (177)

So, I was doing a tutorial for space invaders, and i did the same exact code as the tutorial. The tutorial looked like this:

But mine looks like this:

Can someone tell me what i did wrong?
PS mine isn't any smaller it's just zoomed out

Comments
hotnewtop
InvisibleOne (3200)

Oh I see the problem, the tag in your HTML linking your script is for script.js, change that to app.js

InvisibleOne (3200)

I don't know if it matters but shouldn't it be
alienInvaders.forEach( (invaders)=> ...
instead of
alienInvaders.forEach( invaders => ...

Baconman321 (1103)

@InvisibleOne If you only have one argument then you can omit the parenthesis on an arrow function...

InvisibleOne (3200)

Ok cool, I'll have to remember that @Baconman321