Passing random generated numbers

i am struggling to plug the random generate numbers into the next function - what am I doing wrong?

Codepen link

You need to call moduloEx7. You have one random number num1, but moduloEx7 expects 2, so you might want to make another one and use that in the second argument.

let num1 = getRandomNumber(1 , 100);
let num2 = getRandomNumber(1 , 100);
moduloEx7(num1, num2);

Right that’s because I’ve been messing with this for too long.
So the issue I’m having is the result of the code once I call moduloEx7 from the console is that I still get undefined on num1 and num2. I can’t figure out why the values generated by the random function don’t get assigned to them

Hi Isaac! Welcome to the forums :slight_smile:

It looks like you are declaring moduleEx7 twice, which is an error when declaring variables using let. If you change the variable declaration to what @senocular mentions above where you call the moduleEx7 function without the variable declaration, the code works:

moduloEx7(num1 , num2);

If you need the variable declaration, rename the variable to something else:

let moduloEx = moduloEx7(num1 , num2);

I created a fork of your pen that works:

Does this help?


yes, thank you very much!