I always try to use JavaScript when posting a code golf solution, but there are a few things I'm wondering:
- It is said that global variables are allowed. However, what if the code can therefore only be run once, because the second time the code messes up due to existing global variables?
- Should the code immediately output what's expected or should it rather be a function?
- What functions should be used for input/output?
console.log
is obviously longer thanalert
, butalert
is not available in all implementations. Also, should input be asked for or is the input data already in some variable? - Is it allowed to use expression closures, which are actually only available in Firefox?