Prevent Ampersand Issues in Javascript on WordPress Pages & Posts

Ampersands in WordPress Posts and Pages are always encoded into either their numeric (&) or name (&) html entity. This can become troublesome if you are including javascript into the page or post.

Using the ampersand’s unicode code point value (0026) is the best way around this issue.
So writing ampersand would be done by using: document.write('\u0026'); Instead of document.write('&');
And using the && logical operator, you can wrap your statement with the eval function. Turning this: console.log(true && true);, into this: eval('console.log(true \u0026\u0026 true)');

If you have alternative methods of dealing with this issue, please leave a comment or a link below.