Ask coding questions

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

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

InvisibleOne (2840)

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

InvisibleOne (2840)

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

Baconman321 (1101)

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

InvisibleOne (2840)

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