Ask coding questions

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

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

Voters
bwoop
Comments
hotnewtop
InvisibleOne

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

InvisibleOne

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

Baconman321

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

InvisibleOne

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