When I'm lazy to copy my Javascript code to some other place in which I could "console.log" — which I would recommend.
I use
throw new Error('My values is: ' + whateverValue);
As expected, this will interrupt the execution and come back as an error with the desired text.