Function definition is not allowed here

function definition is not allowed here
That’s because you can’t define a function inside a function,

Read More: