I am trying to get the higest number from an array by looping over the items but the result im getting back is not correct. I also tried using the math.max function but it didn't work. My code is attached below. Any help is appreciated. Thanks in advance.
const lol = ['2', '2211', '9']
var largest = lol[0];
for (var i = 0; i < lol.length; i++) {
if (largest < lol[i]) {
largest = lol[i];
}
}
console.log(largest); //should have been 2211