21 Day Coding Challenge

Challenge #4 Help?


Hey gang,

I’ve been stuck on challenge 4 for a while and I can’t figure out what’s wrong with my code. It’s saying that it runs, it’s just not producing the correct result.

function loadModule(index) {
if (availableModules[index].essential === true) {
availableModules[index].enabled = true;
} else {
return null;

function loopModule() {
for (var i; i < 8; i++) {
if (availableModules[i].name == “life-support”) {


Any help would be much appreciated!


Hi Duncan,
I’ll point you towards what I suspect is causing you issues:

for (var i; i < 8; i++) {

There’s 2 “errors” in that line… :slight_smile:

The rest seemed to be ok.

Let us know if you need more hints. :four_leaf_clover:

1 Like

I’m thinking your var i needs to have a value assigned to it and your i needs to be less than the length of the available modules.

1 Like

Got it!! Thanks Seb :slight_smile:

1 Like