'For Loops' Conclusion: code goes through but does not print


#1

Hi all, I've been sitting here trying to get the sentence to print with each item in the array, but when I submit it just allows me to continue, but does not print anything to the screen. I would appreciate some help at this point, because nothing I do to it seems to fix it, and could use a set of fresh eyes.

var xmen = function (n) {
    console.log(n+ " has found their mutant power and become an X-Men member!");};
    
var names = ["Ruby", "Binna", "Matt", "Yoda"];

for (i = 0; i > names.length; i++) {
    xmen(names[i]) };


#3

Problem with for loop:

i < names.length

UPDATED.
My version:

var xmen = function (n) {
   for (var i = 0; i < n.length; i++) {
      console.log(n[i] + " has found their mutant power and become an X-Men member!");		
   }
};
    
var names = ["Ruby", "Binna", "Matt", "Yoda"];
xmen(names);

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.