function greet (user) {
  if (user.gender === 'male') {
    let fullname = 'Mr. ' + user.name
  } else {
    let fullname = 'Ms. ' + user.name
  }
  console.log('Hello, ' + fullname)  
}

greet({ name: 'John', gender: 'male' })
Click here for solution
We can fix this by placing 'let' on a higher scope.