Grammar Checker - Stuck at point number 10

Hi all,

I made this line based on the 10-point requirements but seems that is not working.
const lengthCheck = storyWords.every(word => word.length < 10);

Error:
TypeError: Cannot read property ‘length’ of undefined

Welcome to the Get Help category!

This is where you can ask questions about your code. Some important things to remember when posting in this category :slight_smile:

  • Learn how to ask a good question and get a good answer!
  • Remember to include a link to the exercise you need help with!
  • If someone answers your question, please mark their response as a solution :white_check_mark:
  • Once you understand a new concept, come back and try to help someone else!

The problem isn’t necessarily that line of code. The issue is actually the array that the .every() function is being called on. It is either not being created properly, or you are not referring to it correctly. In other words, the program looks for the array but cannot find it. So it then throws the error saying it is undefined. The array might not be there, or maybe it is there but the program checks the wrong name. Try console.log() the array and see if anything shows up

1 Like

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