Trouble adding two functions

new to learning js, i’m able to call the first two functions correctly, when i try to log the third function to the console i get “nan”, when logging ‘total score’ to the console im trying to get the ‘touchDown’ + ‘extraPoint’
please help.
thanks

const touchDown = td => {
  var  touchDown
  return td * 6;
};
const extraPoint = fg => {
  var  extraPoint
  return fg * 1;
};
const totalScore = Ts => {
  let totalScore = touchDown() + extraPoint();
  return totalScore;
  };

console.log(touchDown(5) + extraPoint(4)) //returns 34
console.log(totalScore(5,4)) //returns nan

Your function totalScore expects one argument, but you pass two.

The one argument the function expects is used nowhere, though.
totalScore and extraPoint expect one argument each. But you do not pass any.

Your function totalScore needs two parameters. One of them must be used as an argument for the touchDown function, the other for the extraPoint function.

Solution
const totalScore =(arg1, arg2) => {
  let totalScore = touchDown(arg1) + extraPoint(arg2);
  return totalScore;
};
3 Likes

@mirja_t thanks so much for your quick reply. im starting to grasp the concept better :slight_smile:

1 Like