To debug client side code use code inspector for example Chrome/Edge DevTools.
Here is a example of a trivial function with one statement where we can put the breakpoint on.
Set The Breakpoint
Trigger The Function
For example if the function is registered for the OnSave event of the form save the form to trigger the function.
Open Console and Access the Objects