im trying to Find the Smallest and Biggest Numbers. i can do this in for > let. but when i try to put this in a function it does not work.
const myNumbers = [1111, 245, 535 ,222, 221,12,233444];
function findnum(){
for (let i=0; i < myNumbers.length ; i++ ){
    const smallNum = Math.min(...myNumbers)
    const bigNum = Math.max(...myNumbers)
    break
}
}
result = findnum(smallNum,bigNum)
console.log(result)