output += input.charCodeAt(pos); if(pos != (input.length - 1)) {
output += ",";
}
}
return output;
}
let encoded = encode_to_javascript('insert_minified_javascript')
console.log(encoded)
Listing 126 - JS Encoding JS Function The
encode_to_javascript function will parse the minified JS string parameter and convert each
character into the corresponding UTF-16 integer code using the
charCodeAt 380
method.
Let’s run the function from the browser’s console.
Figure 117: Encoding the Minified JS with the Browser Console 380
(Mozilla, 2022), https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt