Iterating over array with for-in method

Hi, I am working on the finding the longest word challenge in the JS section. I tried to use a for-in loop to iterate over my array of strings but it didn’t work. When I used a standard for loop and indexes, it works perfectly fine and passes the challenge. Can somebody please explain why one works, but the other one doesn’t?

function findLongestWordLength(str) {
  
  // This works

  let arr = str.split(" ");
  let longest = 0;
  for (let i = 0; i < arr.length; i++) {
    if (arr[i].length > longest) {
      longest = arr[i].length;
    }
  }
  return longest;
  */

  // This doesn't work

  let arr = str.split(" ");
  let longest = 0;
  for (let item in arr) {
    if (item.length > longest) {
      longest = item.length;
    }
  }
  return longest;
}

for...in is for iterating over the properties of an object, not an array.

You probably wanted to look at for...of instead.