For example, if you have a number of alert( )
invocations in
your program, like this:
alert("An error has occurred");
you could set a global variable, like this:
msg="An error has occurred";
to serve as a string constant and then replace the repeated strings in the various
alert( )
calls as follows:
alert(msg);
You can even use this macro expansion idea for partial strings. For example, use the earlier string constant that we set and modify it:
alert(msg+": email address is required");