Temukan nomor terbesar dari array di JavaScript

const array = [3 , 6, 2, 56, 32, 5, 89, 32];
let largestNum= array[0];

for (let i=1; i<array.length; i++){
    if (array[i]>largestNum) {
        largestNum = array[i];
    }
};
console.log(largestNum);
Different Dogfish