-
Safely Encoding Any String Into JavaScript Code Using JavaScript
When generating a JavaScript file dynamically it’s not uncommon to have to embed an arbitrary string into the resulting code so it can be operated on. For example:function createCode(inputValue) { return “function getValue() { return ‘” + inputV…