Is there a way that I can define a macro similar to C/C++ macros in Javascript?
I want to use this for debug statements: Something like
#ifdef TEST
While is true that there is no compile time as @sapht said, you can pre-process your files if you want. Typically I use an ant script to combine many Javascript files together and add build information.
From a google search I see there is a Javascript preprocessor that you may find interesting: http://www.bramstein.com/projects/preprocess/