xxxxxxxxxx
// Define a utility function that adds two numbers
const addNumbers = (a, b) => {
return a + b;
}
// Then call it elsewhere
addNumbers(3, 8);
// Define a utility function that capitalizes the first letter of a string
const capitaliseString = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
}
// Then call it elsewhere
capitaliseString("hello there");
// Define a utility function that generates a random number between two values
const getRandomNumber = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min);
}
// Then call it elsewhere
getRandomNumber(2, 28563);