Where is my function going wrong?

function sumTwoSmallestNumbers(arr) {  
    let min1  = Math.min(...arr);
    const index = arr.indexOf(min1);
    arr.splice(index, 1);
    let min2 = Math.min(...arr);
    return min1 + min2;

This returns a TypeError: Found non-callable @@iterator on the second line

hello @arc5499240756 !

just want to check you’re running this script as Pure Vanilla JS or via one of the JS framework?

because I could run the script just fine on an online compiler.

(Kinda new to this) I think it was vanilla JS. I tried to run it on VS Code and it just came back with error. I don’t think I am using a framework, I’ve used the extension Code Runner to run the code.