Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help translating

    i know nothing about java script, but i need to translate this so another program can understand it.

    here's the code:

    function jal(str){var zwq = '';for(var i=0;i < str.length;i++){zwq += ''+str.charCodeAt(i).toString(16);}return zwq;}

    where the str = "http://atdhenet.tv/"

    there's another var that is assigned like this

    var kol = jal("http://atdhenet.tv/")

    so i just need to know what var kol will end up being :/

    thanks for all your help

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,550
    Thanks
    78
    Thanked 4,382 Times in 4,347 Posts
    You could have found out by simply creating an HTML page with *ONLY* this content:
    Code:
    <script>
    function jal(str){var zwq = '';for(var i=0;i < str.length;i++){zwq += ''+str.charCodeAt(i).toString(16);}return zwq;}
    
    var kol = jal("http://atdhenet.tv/");
    
    document.write(kol);
    </script>
    and then showing that HTML page in your browser.

    You would have seen:
    Code:
    687474703a2f2f61746468656e65742e74762f
    But you could also have translate it by hand by simply looking up the hexadecimal value of each character in the string.

    That is, "h" has hex value "68", "t" has value "74", etc.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •