Obfuscation at a glance
How it works
JS obfuscation often makes use of the eval() feature of JS, which allows an arbitrary string to be evaluated using the JS evaluation engine. This allows the breakdown of actual source code into fragments of strings which, when combined in some way and fed to eval(), can achieve the same effect as the original code.
x=['a', 'l', 'e', 'r', 't', '(', '\"', 'H', 'e', 'l', 'l', 'o', '\"', ')']; eval(x.join(''));would result in the display of an alert message "Hello" in the browser.
With some more thinking, one can increase the level of confusion by using techniques like breaking up the array to further fragments, substituting characters with their ASCII codes and using function calls, loops and other control structures to break up the code fabrication algorithm.