Mixed Messages - One Liner Jokes

Hi there,
Can anyone here please have a look at this project and let me know where I am wrong. I am not getting the desired output here.

thank you.

[https://github.com/PiyaSonvane/randomJokes/blob/main/randomJokes.js](randomJokes/randomJokes.js at main · PiyaSonvane/randomJokes · GitHub)

One thing I’ve found helpful is the debugging section where they tell you to console.log things as you’re writing.

try to assign more of your code to variables so you can break it up and console log it to make sure it’s giving you the output you expect.

for example I’ve added some console.log to your function below. If you paste it into your script and run it, it will throw an error that can give you clues to what’s wrong.

function theMessage(message) { //random selection of oneLiner jokes let jokeRand = randNums(message.jokeToday.nums) console.log(jokeRand) //random selection of its type let typeRand = randNums(message.typeToday.nums) console.log(jokeRand) //printing the combination of the whole oneLiner jokes with its type to the console console.log(`One liner Joke for today: ${message.jokeToday[jokeRand]} and this is ${message.typeToday[typeRand]}`)

The error I got was NaN. You need to pass a number into randNums(). Instead of randNums(message.jokeToday.nums), try randNums(message.jokeToday.length)

The example code that is linked at the beginning of the project. i had to zoom out on my browser to see the link.