Ask coding questions

← Back to all posts
laksh5 (83)

When I try to find the length of "Powers", it says undefined. Please help!

Answered by heyitsmarcus (287) [earned 5 cycles]
View Answer
heyitsmarcus (287)

You called your original power array powers, so you just left an s off of your variables in this line:

var powerer = power[Math.floor(Math.random() * power.length)];

Change to:

var powerer = powers[Math.floor(Math.random() * powers.length)];

If this solved your problem, please consider upvoting and marking my answer as the accepted answer to close this question. I'll continue to answer questions you may have.