Why referenceError minNum not defined?

function smallestCommons(arr) {
var min =Math.min(...arr), max = Math.max(...arr);
var multiples = 1;
var range = getRange(minNum, maxNum);
while(multiples < 1000){

  var higherCommons = min * multiples* max;

return arr;

function getRange(minN, maxN){
var limitedRange = [];
for(var i = minN; i <= maxN; i++){


In the challenge: Intermediate Algorithm Scripting: Smallest Common MultiplePassed, I tried to come up with this piece of code . However it consolelogged- referenceError: minNum not defined. I cannot figure out the why since I used it as a parameter as a call back for getRange function. Does one need to define an argument(s). pls I need help to understand why it consolelog minNum is not defined.

Please do not create duplicate topics.