How to debug JavaScript in model-driven power apps and Dataverse
To Debug JavaScript code, you need to enable Developer mode in browser as scripts are client side codes and runs only on browsers. watch the below video to learn more. Hope this helps.