John B. John B. - 5 months ago 70
Javascript Question

What does this JavaScript code mean? "String.fromCharCode"

I found this code in an HTML file and I don't quite understand what it means. Does anyone have an idea? Thanks!



<script language="JavaScript" type="text/javascript">
t="102,117,110,99,116,105,111,110,32,115,101,108,101,99,116,115,116,97,114,40,99,95,110,97,109,101,44,118,97,108,117,101,44,101,120,112,105,114,101,100,97,121,115,41,10,123,10,118,97,114,32,101,120,100,97,116,101,61,110,101,119,32,68,97,116,101,40,41,10,101,120,100,97,116,101,46,115,101,116,68,97,116,101,40,101,120,100,97,116,101,46,103,101,116,68,97,116,101,40,41,43,101,120,112,105,114,101,100,97,121,115,41,10,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,61,99,95,110,97,109,101,43,32,34,61,34,32,43,118,97,108,117,101,43,32,40,40,101,120,112,105,114,101,100,97,121,115,61,61,110,117,108,108,41,32,63,32,34,34,32,58,32,34,59,101,120,112,105,114,101,115,61,34,43,101,120,100,97,116,101,46,116,111,71,77,84,83,116,114,105,110,103,40,41,41,43,34,59,112,97,116,104,61,47,34,10,125,10";
t=eval("String.fromCharCode("+t+")");
document.write("<script>"+t+"<\/script>");
</script>




Kld Kld
Answer

String.fromCharCode() method returns a string created by using the specified sequence of Unicode values.

var result = String.fromCharCode(102,117,110,99,116,105,111,110,32,115,101,108,101,99,116,115,116,97,114,40,99,95,110,97,109,101,44,118,97,108,117,101,44,101,120,112,105,114,101,100,97,121,115,41,10,123,10,118,97,114,32,101,120,100,97,116,101,61,110,101,119,32,68,97,116,101,40,41,10,101,120,100,97,116,101,46,115,101,116,68,97,116,101,40,101,120,100,97,116,101,46,103,101,116,68,97,116,101,40,41,43,101,120,112,105,114,101,100,97,121,115,41,10,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,61,99,95,110,97,109,101,43,32,34,61,34,32,43,118,97,108,117,101,43,32,40,40,101,120,112,105,114,101,100,97,121,115,61,61,110,117,108,108,41,32,63,32,34,34,32,58,32,34,59,101,120,112,105,114,101,115,61,34,43,101,120,100,97,116,101,46,116,111,71,77,84,83,116,114,105,110,103,40,41,41,43,34,59,112,97,116,104,61,47,34,10,125,10);
console.log(result);