Hey Ibrahim,
It is not possible for javascript to be used in backend.
Hope it answers your question!
No. The front end can use Javascript, but the back end compiles down to run a JVM. If you want to add code to the back end this is done using Java.
If you are interested in adding custom Java to the back end, the following link is a good explainer.
https://docs.mendix.com/howto/logic-business-rules/extending-your-application-with-custom-java/
Hope this helps.