E056 – ‘addNewJoke’ was used before it was declared, which is illegal for ‘const’ variables [duplicate]

I’m a beginner web developer but as far as I know, we can use call functions before declaring.
The guy I am learning from did exactly the same, like no difference but there was no problem for him.

problem: E056 – ‘addNewJoke’ was used before it was declared, which is illegal for ‘const’ variables. I also tried using let but still the same problem.

Heres the code:

const jokes = document.querySelector("#jokes")
const button = document.querySelector('button')
button.addEventListener('click', addNewJoke)

const addNewJoke = async () => {
const jokeText = await getDadJoke();
console.log(jokeText)

}


const getDadJoke = async () => {
const headers = {headers: {Accept: 'application/json'}}
const res = await axios.get('https://icanhazdadjoke.com/',headers);
return res.data.joke;
}
getDadJoke();