The reason this doesn't work in the same way is because it requires you to know where the error occurs.
You tend to operate on a data structure and know that at some point x becomes y. By placing a watch on x you find out where that point is.
Editing the code does not get you this (bar modern proxies in js).
if(x) {
debugger
}
Play with conditional watchpoints in gdb to understand why this does not make sense as a reply to the comment explaining why this is not a substitute.
Aha. I sometimes use ES5 defineProperty where you can define get and set functions. I built an ORM using defineProperty. Where changing a value triggers an database update.
But the best way is to avoid globals or only update it at one place.