Assignment 2 simpleScore() function

Hi guys,
I’m getting the error “TypeError: Cannot read property ‘length’ of undefined” in relation to word.length in my below function. Do I need to define ‘word’ within the function?

let simpleScore = function(word) {
return word.length;
};

In other simple function examples within the readings (like plusTwo() below), you don’t have to redefine, so I feel like I’m missing something?

function plusTwo(num) {
return num + 2;
};

Hey there,

Your intuition is correct, you don’t need to define ‘word’ in the function because you are defining ‘word’ as a parameter in your function expression for simpleScore. Your function simpleScore expects to be called with one argument and then returns its length value. ‘Word’ represents that argument in the function’s code.

The issue may be that you are calling simpleScore without an argument. Where in your program are you invoking the simpleScore function? Looking there may help.

Thank you @jwrounds !! I never would have solved that on my own! I was calling the simpleScore() function later in an object, when I should have only put simpleScore instead.