Nesting For Loops - seems like my loop is not running

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

Tell us what’s happening:
So it seems like the loop is not running in my code. But I don’t know why.
I’ve looked at suggested solutions, I’ve dug for the small stuff. But somehow I’m not seeing whats wrong here.

I noticed that if I do a console.log with a value in the first or second level of the loop, I don’t seem to get any output to the console.

Your code so far


function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i =0; i < arr.lenght; i++){
    for (var j=0; j < arr[i].lenght; j++){
    product = product * arr[i][j];
    }
  }
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops

You spelled “length” incorrectly.

1 Like

Leslie :star::star::star::star::star:

'Thank you so much. It’s getting pretty late out here, 00:01 local time. I think I should head off to bed when I start making silly mistakes like spelling errors :wink:

Sounds like a good idea. :sleeping: