dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: javascript charCodeAt()

  1. #1
    Join Date
    Oct 2015
    Posts
    5

    javascript charCodeAt()

    Why all the letter strings get to the same output 48, 49, etc
    I expected that each letter gets to her private code number from 066 to 091
    ...
    HTML Code:
    function findCode(str) {
    
      for (i = 0; i < str.length; i ++) {
        console.log(String.charCodeAt(i))
      }
      return str;
    }
    
    findCode("abce");
    I'm sorry if the question is too easy...

  2. #2
    Join Date
    Jul 2011
    Posts
    193
    function findCode(str) {
    for (i = 0; i < str.length; i ++) {
    console.log(str.charCodeAt(i))
    }
    }
    findCode("ABCDE");

  3. #3
    Join Date
    Oct 2015
    Posts
    5
    Oups!!!
    What a shame!
    Thank you @DaveyErwin!

  4. #4
    Join Date
    Oct 2015
    Posts
    5
    Oups!!!
    What a shame!
    Thank you @DaveyErwin!
    I confused with String.fromCharCode().
    Ridicule mistake...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles