Debugging for userscripts

It would be wonderful to be able to debug a userscript in a manner similar to that of stepping through PHP code – perhaps not the full-fledged support for setting watchpoints, etc., but at least being able to step through the JavaScript statements and observe the values of variables as they change.