how to #define a constant&
-
I want to make some sort of C trace.
function trace(level,param)
{
if (level>=TRACELEVEL)
console.log(param);
}#define TRACE_FATAL 0
#define TRACE_INFO 7
#define TRACELEVEL TRACE_INFO
How to implement constas in Javascript like
FIND_MY_CREEPS: 102
-
You can declare them in global scope (outside your main loop) as follows:
global.<nameofvariable> = "stuff";
This is also accessible by the console.
You can also define methods this way:
global.test = function() {console.log("Hello world!");}
Your can type test(); in your console and it will call the function!