21 Day Coding Challenge

Little bit behind, need help on challenge 4


function powerOn () {
ship.powerOn = true;
countModules = function(){
return availableModules.length

function countEssential(){
var count = 0;
for (var i = 0; i <availableModules.length; i++){
if (availableModules[i].essential){


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

function loopModule(){
for (let i = 0; i < availableModules.length; i++){
if (availableModules[i].name === ‘life-support’){

Confused as to why this isnt working for challenge 4. Would really appreciate some help.


Hi Jonathan,
Do you happen to have the error message? Is it the one about the code running but not producing the proper results?


My error message is as follows : Your code ran but did not produce the correct result. Hint: confirm your functions are properly solving the challenge.

Thanks for the swift response.


If I told you that this line is the culprit, would you see why? (I can say more)


DANG. Thanks a lot man.

1 Like

Let us know if it works. But it’s the only thing I saw that didn’t work on my end.


It worked, thanks so much. Cant believe i missed it

1 Like