how can i make this function?(same result check)

I’m making MBTI app with ReactJS
But I have some problem now

When I click button i got some string ex ‘E or I’
and then When it finished I got String value ex’EEINNSTTFPPJ’
so I want to change this value to ‘ENTP’

How Can I make it ?

TOTAL_SLIDES = 13;

    useEffect(() => {
        currentSlide > TOTAL_SLIDES && history.push(`/result/${mbti}`)
        console.log(`${mbti}`)
        mbitChecker()
    })

When I click button i get those value

MBTI Result == E
option.jsx:253 MBTI Result == EE
option.jsx:253 MBTI Result == EEI
option.jsx:253 MBTI Result == EEIN
option.jsx:253 MBTI Result == EEINN
option.jsx:253 MBTI Result == EEINNS
option.jsx:253 MBTI Result == EEINNST
option.jsx:253 MBTI Result == EEINNSTT
option.jsx:253 MBTI Result == EEINNSTTT
option.jsx:253 MBTI Result == EEINNSTTTP
option.jsx:253 MBTI Result == EEINNSTTTPP