How to use variable which used inside function out of function js reactjs

I get array names flashcards when I mount the app.

flashcards=[
{id:1, check1:false, check2:false, check3:false},
{id:2, check1:true, check2:true, check3:true},
{id:3, check1:true, check2:false, check3:false}
]

I filtered this array if check1,check2,check3 are true.
I filtered this array inside function. But I want to use filtered object outside function.

  let fl;
  console.log('fl outside',fl)  // undefined

  const checkIfAuth = () => {
  if (flashcards.statusCode === 401 || flashcards.statusCode === 403) {
    console.log('This is not authorized')
    setAuth(true)
  } else {
    // console.log('Authorizaed')
    setAuth(false)
    const checkIfFlase = (flashcard) => {
      return flashcard.check1 === false || flashcard.check2 === false || flashcard.check3 === false
     }
    
     fl = flashcards.filter(checkIfFlase)
     console.log('fl inside', fl)   
   // ↑ filtered right objects 
   // [{id:1, check1:false, check2:false, check3:false},{id:3, check1:true, check2:false, check3:false}]
    
  } 
}

How can I update fl outside function?

Any advice is appreciated.