You question is indeed fundamental. Please have a look at the Requesting Help guidelines.
You need to go through the Docs. Particularly the safeJS
function.
I am closing this topic since there are dozens of similar topics.
If you cannot solve this then you really need to share the project in question.