Can some please explain to me the difference between the function keyword and const in declaring a function

As demonstrated in the below examples, I used the function keyword to declare a function that will generate a random integer number within a range, and I also used a const keyword to declare another function that will convert a string and return an integer. Your brief explanation will be helpful and appreciated.

//Generating a random whole number within a range.
function isBeginner(a1, a2) {
  let randomRange = "";
  if (a2 >= a1) {
    randomRange = Math.floor(Math.random() * (a2 - a1 + 1) + a1);
  } else {
    randomRange = Math.floor(Math.random() * (a1 - 1 + a2) - a1);
  }
  return randomRange;
};

console.log(isBeginner(2, 4)); //positive integer expected
console.log(isBeginner(5, 3)); //negative integer expected

//Using ParseInt to generate an Integer

const isBeginner2 = function(lib) {
  let crib = "";

  // using Switch statement for better descriptions
  switch (lib) {
    case "Zero before a real number":
      crib = parseInt(lib)
      break;

    case "String":
      crib = parseInt(lib);
      break;

    case "Decimal number":
      crib = parseInt(lib);
      break;

    case "Letter before a number":
      crib = parseInt(lib);
      break;

    case "Number before a letter":
      crib = parseInt(lib);
      break;

    default:
      crib = parseInt(lib);
      break;

  }
  return crib;
};

console.log(isBeginner2(005)); // output **5** expected
console.log(isBeginner2("Stay Healthy")); // output **NaN** expected
console.log(isBeginner2(1.5)); // output **1** expected
console.log(isBeginner2("E7")); // output **NaN** expected 
console.log(isBeginner2("8S")); // output **8** expected