Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for answer to Convert character to ASCII code in JavaScript by Jim

Current License: CC BY-SA 4.0

Post Revisions

26 events
when toggle format what by license comment
Apr 26, 2023 at 9:07 history edited Flimm CC BY-SA 4.0
Include caveats about Unicode
Dec 15, 2020 at 11:25 comment added Laurent Payot charCodeAt() without argument gives an error in TypeScript.
Jun 27, 2019 at 20:54 comment added Taugenichts including 0 is now slower on Chrome 75 by 2% for anyone interested... interestingly, the .charCodeAt(1) was the most performant (.03% faster than no args)
Feb 4, 2019 at 6:58 comment added Mahesh Jamdade please don't just give the solution explain why it would work with a supportive answer
Mar 8, 2017 at 15:18 comment added Andrew Apparently omitting the 0 is slower, if anyone cares. See royhowie's comment on Marco Altieri's answer below.
Feb 6, 2017 at 12:11 history rollback Jim
Rollback to Revision 5
S Feb 6, 2017 at 3:49 history suggested abhisekp CC BY-SA 3.0
Add es6 codePointAt method
Feb 6, 2017 at 2:38 review Suggested edits
S Feb 6, 2017 at 3:49
Apr 1, 2016 at 13:56 comment added KingRider @developerbmw Try "ABC".charCodeAt(0) // return 65 is just A ... position array, other position B is "ABC".charCodeAt(1) // return 66, i agre @Mathias is correct.
Mar 11, 2016 at 5:01 review Suggested edits
Mar 11, 2016 at 5:59
Jan 14, 2016 at 23:09 review Suggested edits
Jan 15, 2016 at 0:08
May 28, 2015 at 21:40 comment added brettwhiteman @MathiasBynens charCodeAt() with no arguments makes little sense
Jun 18, 2014 at 12:05 comment added Lior I think it's a bit clearer (readability wise) to specify the index instead of leaving it to defaults...but it's minor anyway
May 9, 2014 at 20:55 comment added Qix - MONICA WAS MISTREATED @wademontague I would have never thought to perf-test that. That's so ridiculous! Thanks for the results.
May 9, 2013 at 12:35 comment added wade montague @Mathias Bynens, It certainly does default to zero but I just ran a just out of interest test on performance and it performs **relatively badly compared using 0. jsperf.com/default-to-0-vs-0/4 ** Its a relative difference only, either way its very very quick.
Jan 4, 2013 at 22:24 history rollback Jim
Rollback to Revision 3
Jan 4, 2013 at 19:51 history edited jcollum CC BY-SA 3.0
added 50 characters in body
Nov 9, 2012 at 17:14 history rollback Jim
Rollback to Revision 1
Nov 6, 2012 at 4:29 history edited Starx CC BY-SA 3.0
Removed unnecessary indexing
Sep 12, 2012 at 19:09 comment added bobobobo You should point out that unlike String.fromCharCode( asciiNumVal ), stringInstance.charCodeAt( index ) is not a static method of class String
Nov 15, 2011 at 19:46 comment added tokland @MathiasBynens: and fortunately this is documented: developer.mozilla.org/en/JavaScript/Reference/Global_Objects/…. "if it is not a number, it defaults to 0"
Oct 17, 2011 at 9:40 comment added Mathias Bynens Fun fact: you don’t really need the 0 (first argument value) — just "\n".charCodeAt() will do.
May 1, 2011 at 9:38 comment added viam0Zah The opposite of this is String.fromCharCode(10).
Feb 25, 2011 at 12:18 review Suggested edits
Feb 25, 2011 at 12:19
Sep 18, 2008 at 16:15 vote accept levik
Sep 18, 2008 at 16:15 history answered Jim CC BY-SA 2.5
toggle format

AltStyle によって変換されたページ (->オリジナル) /