Iterate Through the Keys of an Object with a for...in Statement - result is not defined

Pulling my hair out here! I think I’m very close.
Keep getting: ReferenceError: result is not defined.

function countOnline(usersObj) {
  // change code below this line
let result = 0;
for (let user in usersObj)
  {
  if (usersObj[user].online === true)
    {
    result++;
    }
  }
return result;
  // change code above this line
}
countOnline({ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }); 
console.log(result)
console.log(result)

result is only defined inside the countOnline function, which is why you get this error.

Arghh. I guess I was used to testing all those regex challenges and got lazy!

console.log(countOnline({ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }))