How to find the value of a variable quickly and easily.
When writing complex code, (such as Javascript expression in Adobe After Effects), it is often helpful to be able to see what a variable's value is. If you were using javascript in an HTML web page, you could send these values to the browser's Developer Console, using the simple code console.log(). Unfortunately, After Effects does not have the equivalent of a developer console. It does have the info panel, but you can only interact with that when writing a script. For a regular expression (or even an irregular one), I used to use a text layer and edit the sourceText to show the variable. But this was time consuming and not always easy - and quite often, it was confusing.
Instead, a much simpler approach is to throw an error. Using just the code below, the expression halts, After Effects highlights the issue and you can see the value of whatever you ask.
throw new Error( VARIABLE )
or even simpler, just:
throw VARIABLE